diff --git a/fixture/fixture.ac3 b/fixture/fixture.ac3 new file mode 100644 index 00000000..e5b56c8b Binary files /dev/null and b/fixture/fixture.ac3 differ diff --git a/fixture/fixture.voc b/fixture/fixture.voc new file mode 100644 index 00000000..ae564ba1 Binary files /dev/null and b/fixture/fixture.voc differ diff --git a/index.d.ts b/index.d.ts index 78f02db8..2c098ef4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -95,7 +95,9 @@ declare namespace fileType { | 'ics' | 'glb' | 'pcap' - | 'dsf'; + | 'dsf' + | 'voc' + | 'ac3'; interface FileTypeResult { /** diff --git a/index.js b/index.js index 82e2a830..56e17f1e 100644 --- a/index.js +++ b/index.js @@ -919,6 +919,20 @@ const fileType = input => { mime: 'audio/x-dsf' // Non-standard }; } + + 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' + }; + } }; module.exports = fileType; diff --git a/package.json b/package.json index bf39170b..c11a1b50 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,9 @@ "ics", "glb", "pcap", - "dsf" + "dsf", + "voc", + "ac3" ], "devDependencies": { "@types/node": "^11.12.2", diff --git a/readme.md b/readme.md index a4eda412..ad0b3a08 100644 --- a/readme.md +++ b/readme.md @@ -217,6 +217,8 @@ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream - [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format - [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) +- [`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).* diff --git a/test.js b/test.js index e4c79097..7f073eda 100644 --- a/test.js +++ b/test.js @@ -104,7 +104,8 @@ const types = [ 'ics', 'glb', 'pcap', - 'dsf' + 'dsf', + 'voc' ]; // Define an entry here only if the fixture has a different