Skip to content

Commit

Permalink
added ac3 and voc, solves #89
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson committed Apr 12, 2019
1 parent 02f666d commit d892e92
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
Binary file added fixture/fixture.ac3
Binary file not shown.
Binary file added fixture/fixture.voc
Binary file not shown.
4 changes: 3 additions & 1 deletion index.d.ts
Expand Up @@ -94,7 +94,9 @@ declare namespace fileType {
| 'mpc'
| 'ics'
| 'glb'
| 'pcap';
| 'pcap'
| 'voc'
| 'ac3';

interface FileTypeResult {
/**
Expand Down
14 changes: 14 additions & 0 deletions index.js
Expand Up @@ -920,6 +920,20 @@ const fileType = input => {
};
}

if (checkString('Creative Voice File')) {
return {
ext: 'voc',
mime: 'audio/x-voc'
};
}

if (check([0x77, 0x0B])) {
return {
ext: 'ac3',
mime: 'audio/vnd.dolby.dd-raw'
};
}

return null;
};

Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -118,7 +118,9 @@
"wma",
"ics",
"glb",
"pcap"
"pcap",
"voc",
"ac3"
],
"devDependencies": {
"@types/node": "^11.12.2",
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -216,6 +216,8 @@ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream
- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format
- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format
- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File
- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File

*SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).*

Expand Down
3 changes: 2 additions & 1 deletion test.js
Expand Up @@ -104,7 +104,8 @@ const types = [
'dcm',
'ics',
'glb',
'pcap'
'pcap',
'voc'
];

// Define an entry here only if the fixture has a different
Expand Down

0 comments on commit d892e92

Please sign in to comment.