From 56a872c1507dd00e1516633a2709bf8b49c02b7a Mon Sep 17 00:00:00 2001 From: Yanis Benson Date: Fri, 12 Apr 2019 12:23:16 +0300 Subject: [PATCH 1/2] added ac3 and voc, solves #89 --- fixture/fixture.ac3 | Bin 0 -> 138 bytes fixture/fixture.voc | Bin 0 -> 26 bytes index.d.ts | 4 +++- index.js | 14 ++++++++++++++ package.json | 4 +++- readme.md | 2 ++ test.js | 3 ++- 7 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 fixture/fixture.ac3 create mode 100644 fixture/fixture.voc diff --git a/fixture/fixture.ac3 b/fixture/fixture.ac3 new file mode 100644 index 0000000000000000000000000000000000000000..e5b56c8bb4e6025f286b4f54bc074aa26403a28f GIT binary patch literal 138 zcmV;50CoQhcgzGpKre(U1O8If`Sa)0Y&eBr%lkh&XrFPSoUxDtQpul8ez_*) z6b&7=unCqR06Y6>9Ta&*H5h7Z<3yi)K$GA?nkGXN#9hD!Ob_|3`eYWs0pI`wv%W|+ staOIyDv`2`NYyfKNDukd^XJc>K79G}-~f0A!~h3?Y(M~b2EYItskxdxmjD0& literal 0 HcmV?d00001 diff --git a/fixture/fixture.voc b/fixture/fixture.voc new file mode 100644 index 0000000000000000000000000000000000000000..ae564ba1d679545430c6c88ae937a05b469d182f GIT binary patch literal 26 hcmZ=RN=+=uEK5}g%g; { mime: 'application/x.apple.alias' // Invented by us }; } + + 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 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..3eab02f5 100644 --- a/test.js +++ b/test.js @@ -106,7 +106,8 @@ const types = [ 'pcap', 'dsf', 'lnk', - 'alias' + 'alias', + 'voc' ]; // Define an entry here only if the fixture has a different From 3d456b1193a15b6676c6453f80c98bd8d53efc66 Mon Sep 17 00:00:00 2001 From: Yanis Benson Date: Fri, 12 Apr 2019 12:27:10 +0300 Subject: [PATCH 2/2] test for ac3 --- index.js | 2 +- test.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a290fceb..f438532a 100644 --- a/index.js +++ b/index.js @@ -941,7 +941,7 @@ const fileType = input => { }; } - if (check([0x77, 0x0B])) { + if (check([0x0B, 0x77])) { return { ext: 'ac3', mime: 'audio/vnd.dolby.dd-raw' diff --git a/test.js b/test.js index 3eab02f5..0c5069b4 100644 --- a/test.js +++ b/test.js @@ -107,7 +107,8 @@ const types = [ 'dsf', 'lnk', 'alias', - 'voc' + 'voc', + 'ac3' ]; // Define an entry here only if the fixture has a different