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 797219ce..1e2a8700 100644 --- a/index.d.ts +++ b/index.d.ts @@ -97,7 +97,9 @@ declare namespace fileType { | 'pcap' | 'dsf' | 'lnk' - | 'alias'; + | 'alias' + | 'voc' + | 'ac3'; interface FileTypeResult { /** diff --git a/index.js b/index.js index 36217bbd..f438532a 100644 --- a/index.js +++ b/index.js @@ -933,6 +933,20 @@ const fileType = input => { mime: 'application/x.apple.alias' // Invented by us }; } + + if (checkString('Creative Voice File')) { + return { + ext: 'voc', + mime: 'audio/x-voc' + }; + } + + if (check([0x0B, 0x77])) { + return { + ext: 'ac3', + mime: 'audio/vnd.dolby.dd-raw' + }; + } }; module.exports = fileType; diff --git a/package.json b/package.json index 2a39ce3b..ebfd6e60 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,9 @@ "pcap", "dsf", "lnk", - "alias" + "alias", + "voc", + "ac3" ], "devDependencies": { "@types/node": "^11.12.2", diff --git a/readme.md b/readme.md index 35d56ff0..f6859d82 100644 --- a/readme.md +++ b/readme.md @@ -219,6 +219,8 @@ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) - [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut - [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file +- [`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 d0d4ba27..0c5069b4 100644 --- a/test.js +++ b/test.js @@ -106,7 +106,9 @@ const types = [ 'pcap', 'dsf', 'lnk', - 'alias' + 'alias', + 'voc', + 'ac3' ]; // Define an entry here only if the fixture has a different