file-type 17.0.2 → 17.1.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/core.d.ts +2 -0
- package/core.js +8 -0
- package/package.json +2 -1
- package/readme.md +1 -0
- package/supported.js +2 -0
package/core.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export type FileExtension =
|
|
|
49
49
|
| 'pdf'
|
|
50
50
|
| 'epub'
|
|
51
51
|
| 'mobi'
|
|
52
|
+
| 'elf'
|
|
52
53
|
| 'exe'
|
|
53
54
|
| 'swf'
|
|
54
55
|
| 'rtf'
|
|
@@ -195,6 +196,7 @@ export type MimeType =
|
|
|
195
196
|
| 'audio/wavpack'
|
|
196
197
|
| 'audio/amr'
|
|
197
198
|
| 'application/pdf'
|
|
199
|
+
| 'application/x-elf'
|
|
198
200
|
| 'application/x-msdownload'
|
|
199
201
|
| 'application/x-shockwave-flash'
|
|
200
202
|
| 'application/rtf'
|
package/core.js
CHANGED
|
@@ -214,6 +214,13 @@ class FileTypeParser {
|
|
|
214
214
|
|
|
215
215
|
// -- 4-byte signatures --
|
|
216
216
|
|
|
217
|
+
if (this.check([0x7F, 0x45, 0x4C, 0x46])) {
|
|
218
|
+
return {
|
|
219
|
+
ext: 'elf',
|
|
220
|
+
mime: 'application/x-elf',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
217
224
|
if (this.check([0x47, 0x49, 0x46])) {
|
|
218
225
|
return {
|
|
219
226
|
ext: 'gif',
|
|
@@ -477,6 +484,7 @@ class FileTypeParser {
|
|
|
477
484
|
const brandMajor = this.buffer.toString('binary', 8, 12).replace('\0', ' ').trim();
|
|
478
485
|
switch (brandMajor) {
|
|
479
486
|
case 'avif':
|
|
487
|
+
case 'avis':
|
|
480
488
|
return {ext: 'avif', mime: 'image/avif'};
|
|
481
489
|
case 'mif1':
|
|
482
490
|
return {ext: 'heic', mime: 'image/heif'};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "17.0
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"check",
|
|
52
52
|
"is",
|
|
53
53
|
"exif",
|
|
54
|
+
"elf",
|
|
54
55
|
"exe",
|
|
55
56
|
"binary",
|
|
56
57
|
"buffer",
|
package/readme.md
CHANGED
|
@@ -371,6 +371,7 @@ Returns a `Set<string>` of supported MIME types.
|
|
|
371
371
|
- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
|
|
372
372
|
- [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file
|
|
373
373
|
- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket
|
|
374
|
+
- [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format
|
|
374
375
|
- [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file
|
|
375
376
|
- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file
|
|
376
377
|
- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format
|
package/supported.js
CHANGED
|
@@ -47,6 +47,7 @@ export const extensions = [
|
|
|
47
47
|
'amr',
|
|
48
48
|
'pdf',
|
|
49
49
|
'epub',
|
|
50
|
+
'elf',
|
|
50
51
|
'exe',
|
|
51
52
|
'swf',
|
|
52
53
|
'rtf',
|
|
@@ -193,6 +194,7 @@ export const mimeTypes = [
|
|
|
193
194
|
'audio/wavpack',
|
|
194
195
|
'audio/amr',
|
|
195
196
|
'application/pdf',
|
|
197
|
+
'application/x-elf',
|
|
196
198
|
'application/x-msdownload',
|
|
197
199
|
'application/x-shockwave-flash',
|
|
198
200
|
'application/rtf',
|