file-type 3.8.0 → 3.9.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.
- package/index.js +7 -0
- package/package.json +3 -2
- package/readme.md +4 -3
package/index.js
CHANGED
|
@@ -32,6 +32,13 @@ module.exports = function (buf) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
if (buf[0] === 0x46 && buf[1] === 0x4C && buf[2] === 0x49 && buf[3] === 0x46) {
|
|
36
|
+
return {
|
|
37
|
+
ext: 'flif',
|
|
38
|
+
mime: 'image/flif'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
// needs to be before `tif` check
|
|
36
43
|
if (((buf[0] === 0x49 && buf[1] === 0x49 && buf[2] === 0x2A && buf[3] === 0x0) || (buf[0] === 0x4D && buf[1] === 0x4D && buf[2] === 0x0 && buf[3] === 0x2A)) && buf[8] === 0x43 && buf[9] === 0x52) {
|
|
37
44
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Detect the file type of a Buffer/Uint8Array",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"png",
|
|
44
44
|
"gif",
|
|
45
45
|
"webp",
|
|
46
|
+
"flif",
|
|
46
47
|
"cr2",
|
|
47
48
|
"tif",
|
|
48
49
|
"bmp",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
],
|
|
97
98
|
"devDependencies": {
|
|
98
99
|
"ava": "*",
|
|
99
|
-
"read-chunk": "^
|
|
100
|
+
"read-chunk": "^2.0.0",
|
|
100
101
|
"xo": "*"
|
|
101
102
|
}
|
|
102
103
|
}
|
package/readme.md
CHANGED
|
@@ -61,14 +61,14 @@ xhr.send();
|
|
|
61
61
|
|
|
62
62
|
### fileType(buffer)
|
|
63
63
|
|
|
64
|
-
Returns an
|
|
64
|
+
Returns an `Object` (or `null` when no match) with:
|
|
65
65
|
|
|
66
66
|
- `ext` - one of the [supported file types](#supported-file-types)
|
|
67
67
|
- `mime` - the [MIME type](http://en.wikipedia.org/wiki/Internet_media_type)
|
|
68
68
|
|
|
69
69
|
#### buffer
|
|
70
70
|
|
|
71
|
-
Type: `
|
|
71
|
+
Type: `Buffer` `Uint8Array`
|
|
72
72
|
|
|
73
73
|
It only needs the first 262 bytes.
|
|
74
74
|
|
|
@@ -79,6 +79,7 @@ It only needs the first 262 bytes.
|
|
|
79
79
|
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics)
|
|
80
80
|
- [`gif`](https://en.wikipedia.org/wiki/GIF)
|
|
81
81
|
- [`webp`](https://en.wikipedia.org/wiki/WebP)
|
|
82
|
+
- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format)
|
|
82
83
|
- [`cr2`](http://fileinfo.com/extension/cr2)
|
|
83
84
|
- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format)
|
|
84
85
|
- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format)
|
|
@@ -145,4 +146,4 @@ It only needs the first 262 bytes.
|
|
|
145
146
|
|
|
146
147
|
## License
|
|
147
148
|
|
|
148
|
-
MIT © [Sindre Sorhus](
|
|
149
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|