Skip to content

Commit

Permalink
Add support for Sony DSF (DSD Stream File) format (#203)
Browse files Browse the repository at this point in the history
Fixes #197
  • Loading branch information
Borewit authored and sindresorhus committed Apr 16, 2019
1 parent a462568 commit be74d72
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
Binary file added fixture/fixture.dsf
Binary file not shown.
3 changes: 2 additions & 1 deletion index.d.ts
Expand Up @@ -94,7 +94,8 @@ declare namespace fileType {
| 'mpc'
| 'ics'
| 'glb'
| 'pcap';
| 'pcap'
| 'dsf';

interface FileTypeResult {
/**
Expand Down
8 changes: 8 additions & 0 deletions index.js
Expand Up @@ -920,6 +920,14 @@ const fileType = input => {
};
}

// Sony DSD Stream File (DSF)
if (check([0x44, 0x53, 0x44, 0x20])) {
return {
ext: 'dsf',
mime: 'audio/x-dsf' // Non-standard
};
}

return null;
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -118,7 +118,8 @@
"wma",
"ics",
"glb",
"pcap"
"pcap",
"dsf"
],
"devDependencies": {
"@types/node": "^11.12.2",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Expand Up @@ -216,6 +216,7 @@ 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
- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)

*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
3 changes: 2 additions & 1 deletion test.js
Expand Up @@ -103,7 +103,8 @@ const types = [
'dcm',
'ics',
'glb',
'pcap'
'pcap',
'dsf'
];

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

0 comments on commit be74d72

Please sign in to comment.