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 c7b6c2ba..6c126cf5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -94,7 +94,9 @@ declare namespace fileType { | 'mpc' | 'ics' | 'glb' - | 'pcap'; + | 'pcap' + | 'voc' + | 'ac3'; interface FileTypeResult { /** diff --git a/index.js b/index.js index cf744b3a..eff23108 100644 --- a/index.js +++ b/index.js @@ -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; }; diff --git a/package.json b/package.json index f2a78f41..7bc1637b 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,9 @@ "wma", "ics", "glb", - "pcap" + "pcap", + "voc", + "ac3" ], "devDependencies": { "@types/node": "^11.12.2", diff --git a/readme.md b/readme.md index ef989cb5..b784a79f 100644 --- a/readme.md +++ b/readme.md @@ -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).* diff --git a/test.js b/test.js index 7efe5588..12ee550f 100644 --- a/test.js +++ b/test.js @@ -104,7 +104,8 @@ const types = [ 'dcm', 'ics', 'glb', - 'pcap' + 'pcap', + 'voc' ]; // Define an entry here only if the fixture has a different