file-type 10.4.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +16 -0
  2. package/package.json +1 -1
  3. package/readme.md +5 -3
package/index.js CHANGED
@@ -878,6 +878,22 @@ module.exports = input => {
878
878
  };
879
879
  }
880
880
 
881
+ // Musepack, SV7
882
+ if (check([0x4D, 0x50, 0x2B])) {
883
+ return {
884
+ ext: 'mpc',
885
+ mime: 'audio/x-musepack'
886
+ };
887
+ }
888
+
889
+ // Musepack, SV8
890
+ if (check([0x4D, 0x50, 0x43, 0x4B])) {
891
+ return {
892
+ ext: 'mpc',
893
+ mime: 'audio/x-musepack'
894
+ };
895
+ }
896
+
881
897
  return null;
882
898
  };
883
899
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-type",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "description": "Detect the file type of a Buffer/Uint8Array",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/file-type",
package/readme.md CHANGED
@@ -38,9 +38,10 @@ const fileType = require('file-type');
38
38
 
39
39
  const url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif';
40
40
 
41
- http.get(url, res => {
42
- res.once('data', chunk => {
43
- res.destroy();
41
+ http.get(url, response => {
42
+ response.on('readable', () => {
43
+ const chunk = response.read(fileType.minimumBytes);
44
+ response.destroy();
44
45
  console.log(fileType(chunk));
45
46
  //=> {ext: 'gif', mime: 'image/gif'}
46
47
  });
@@ -177,6 +178,7 @@ The minimum amount of bytes needed to detect a file type. Currently, it's 4100 b
177
178
  - [`wma`](https://en.wikipedia.org/wiki/Windows_Media_Audio) - Windows Media Audio
178
179
  - [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) - Windows Media Video
179
180
  - [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File
181
+ - [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8)
180
182
 
181
183
  *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).*
182
184