Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ac3 and voc formats #201

Merged
merged 2 commits into from Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -97,7 +97,9 @@ declare namespace fileType {
| 'pcap'
| 'dsf'
| 'lnk'
| 'alias';
| 'alias'
| 'voc'
| 'ac3';

interface FileTypeResult {
/**
Expand Down
14 changes: 14 additions & 0 deletions index.js
Expand Up @@ -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'
stroncium marked this conversation as resolved.
Show resolved Hide resolved
};
}
};

module.exports = fileType;
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -122,7 +122,9 @@
"pcap",
"dsf",
"lnk",
"alias"
"alias",
"voc",
"ac3"
],
"devDependencies": {
"@types/node": "^11.12.2",
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -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
stroncium marked this conversation as resolved.
Show resolved Hide resolved

*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
4 changes: 3 additions & 1 deletion test.js
Expand Up @@ -106,7 +106,9 @@ const types = [
'pcap',
'dsf',
'lnk',
'alias'
'alias',
'voc',
'ac3'
];

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