file-type 17.1.0 → 17.1.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.
Files changed (3) hide show
  1. package/core.js +14 -14
  2. package/package.json +2 -2
  3. package/readme.md +2 -0
package/core.js CHANGED
@@ -151,6 +151,13 @@ class FileTypeParser {
151
151
 
152
152
  // -- 3-byte signatures --
153
153
 
154
+ if (this.check([0x47, 0x49, 0x46])) {
155
+ return {
156
+ ext: 'gif',
157
+ mime: 'image/gif',
158
+ };
159
+ }
160
+
154
161
  if (this.check([0xFF, 0xD8, 0xFF])) {
155
162
  return {
156
163
  ext: 'jpg',
@@ -214,20 +221,6 @@ class FileTypeParser {
214
221
 
215
222
  // -- 4-byte signatures --
216
223
 
217
- if (this.check([0x7F, 0x45, 0x4C, 0x46])) {
218
- return {
219
- ext: 'elf',
220
- mime: 'application/x-elf',
221
- };
222
- }
223
-
224
- if (this.check([0x47, 0x49, 0x46])) {
225
- return {
226
- ext: 'gif',
227
- mime: 'image/gif',
228
- };
229
- }
230
-
231
224
  if (this.checkString('FLIF')) {
232
225
  return {
233
226
  ext: 'flif',
@@ -798,6 +791,13 @@ class FileTypeParser {
798
791
  };
799
792
  }
800
793
 
794
+ if (this.check([0x7F, 0x45, 0x4C, 0x46])) {
795
+ return {
796
+ ext: 'elf',
797
+ mime: 'application/x-elf',
798
+ };
799
+ }
800
+
801
801
  // -- 5-byte signatures --
802
802
 
803
803
  if (this.check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-type",
3
- "version": "17.1.0",
3
+ "version": "17.1.1",
4
4
  "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/file-type",
@@ -198,7 +198,7 @@
198
198
  "dependencies": {
199
199
  "readable-web-to-node-stream": "^3.0.2",
200
200
  "strtok3": "^7.0.0-alpha.7",
201
- "token-types": "^5.0.0-alpha.1"
201
+ "token-types": "^5.0.0-alpha.2"
202
202
  },
203
203
  "devDependencies": {
204
204
  "@tokenizer/token": "^0.3.0",
package/readme.md CHANGED
@@ -6,6 +6,8 @@ The file type is detected by checking the [magic number](https://en.wikipedia.or
6
6
 
7
7
  This package is for detecting binary-based file formats, not text-based formats like `.txt`, `.csv`, `.svg`, etc.
8
8
 
9
+ We accept contributions for commonly used modern file formats, not historical or obscure ones. Open an issue first for discussion.
10
+
9
11
  <br>
10
12
 
11
13
  ---