file-type 10.4.0 → 10.7.1
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.
- package/index.js +31 -1
- package/package.json +7 -5
- package/readme.md +7 -3
package/index.js
CHANGED
|
@@ -812,7 +812,7 @@ module.exports = input => {
|
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
if (check([0x46, 0x4F, 0x52, 0x4D
|
|
815
|
+
if (check([0x46, 0x4F, 0x52, 0x4D])) {
|
|
816
816
|
return {
|
|
817
817
|
ext: 'aif',
|
|
818
818
|
mime: 'audio/aiff'
|
|
@@ -878,6 +878,36 @@ 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
|
+
|
|
897
|
+
if (check([0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A])) {
|
|
898
|
+
return {
|
|
899
|
+
ext: 'ics',
|
|
900
|
+
mime: 'text/calendar'
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) {
|
|
905
|
+
return {
|
|
906
|
+
ext: 'glb',
|
|
907
|
+
mime: 'model/gltf-binary'
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
|
|
881
911
|
return null;
|
|
882
912
|
};
|
|
883
913
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.1",
|
|
4
4
|
"description": "Detect the file type of a Buffer/Uint8Array",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -114,11 +114,13 @@
|
|
|
114
114
|
"odp",
|
|
115
115
|
"xml",
|
|
116
116
|
"heic",
|
|
117
|
-
"wma"
|
|
117
|
+
"wma",
|
|
118
|
+
"ics",
|
|
119
|
+
"glb"
|
|
118
120
|
],
|
|
119
121
|
"devDependencies": {
|
|
120
|
-
"ava": "
|
|
121
|
-
"read-chunk": "^
|
|
122
|
-
"xo": "
|
|
122
|
+
"ava": "^1.0.1",
|
|
123
|
+
"read-chunk": "^3.0.0",
|
|
124
|
+
"xo": "^0.23.0"
|
|
123
125
|
}
|
|
124
126
|
}
|
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,
|
|
42
|
-
|
|
43
|
-
|
|
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,9 @@ 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)
|
|
182
|
+
- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
|
|
183
|
+
- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format
|
|
180
184
|
|
|
181
185
|
*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
186
|
|