Skip to content

Commit

Permalink
Add support for Musepack SV7 & Musepack SV8 (#176)
Browse files Browse the repository at this point in the history
Fixes #175
  • Loading branch information
Borewit authored and sindresorhus committed Nov 19, 2018
1 parent 93a0cdd commit 70bceda
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
Binary file added fixture/fixture-sv7.mpc
Binary file not shown.
Binary file added fixture/fixture-sv8.mpc
Binary file not shown.
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,22 @@ module.exports = input => {
};
}

// Musepack, SV7
if (check([0x4D, 0x50, 0x2B])) {
return {
ext: 'mpc',
mime: 'audio/x-musepack'
};
}

// Musepack, SV8
if (check([0x4D, 0x50, 0x43, 0x4B])) {
return {
ext: 'mpc',
mime: 'audio/x-musepack'
};
}

return null;
};

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ The minimum amount of bytes needed to detect a file type. Currently, it's 4100 b
- [`wma`](https://en.wikipedia.org/wiki/Windows_Media_Audio) - Windows Media Audio
- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) - Windows Media Video
- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File
- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8)

*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: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ const names = {
],
ape: [
'fixture-monkeysaudio'
],
mpc: [
'fixture-sv7',
'fixture-sv8'
]
};

Expand Down

0 comments on commit 70bceda

Please sign in to comment.