file-type 16.2.0 → 16.5.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/browser.js +11 -12
- package/core.d.ts +11 -4
- package/core.js +76 -44
- package/package.json +7 -4
- package/readme.md +110 -76
- package/supported.js +10 -2
package/browser.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const {ReadableWebToNodeStream} = require('readable-web-to-node-stream');
|
|
3
|
-
const toBuffer = require('typedarray-to-buffer');
|
|
4
3
|
const core = require('./core');
|
|
5
4
|
|
|
6
5
|
async function fromStream(stream) {
|
|
@@ -11,25 +10,25 @@ async function fromStream(stream) {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
async function fromBlob(blob) {
|
|
14
|
-
const buffer = await
|
|
15
|
-
return core.fromBuffer(buffer);
|
|
13
|
+
const buffer = await blobToArrayBuffer(blob);
|
|
14
|
+
return core.fromBuffer(Buffer.from(buffer));
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
|
-
Convert
|
|
18
|
+
Convert Blobs to ArrayBuffer.
|
|
20
19
|
@param {Blob} blob - Web API Blob.
|
|
21
|
-
@returns {Promise<
|
|
20
|
+
@returns {Promise<ArrayBuffer>}
|
|
22
21
|
*/
|
|
23
|
-
function
|
|
22
|
+
function blobToArrayBuffer(blob) {
|
|
23
|
+
if (blob.arrayBuffer) {
|
|
24
|
+
return blob.arrayBuffer();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// TODO: Remove when stop supporting older environments
|
|
24
28
|
return new Promise((resolve, reject) => {
|
|
25
29
|
const fileReader = new FileReader();
|
|
26
30
|
fileReader.addEventListener('loadend', event => {
|
|
27
|
-
|
|
28
|
-
if (data instanceof ArrayBuffer) {
|
|
29
|
-
data = toBuffer(new Uint8Array(event.target.result));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
resolve(data);
|
|
31
|
+
resolve(event.target.result);
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
fileReader.addEventListener('error', event => {
|
package/core.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare namespace core {
|
|
|
10
10
|
| 'gif'
|
|
11
11
|
| 'webp'
|
|
12
12
|
| 'flif'
|
|
13
|
+
| 'xcf'
|
|
13
14
|
| 'cr2'
|
|
14
15
|
| 'cr3'
|
|
15
16
|
| 'orf'
|
|
@@ -137,7 +138,10 @@ declare namespace core {
|
|
|
137
138
|
| 'asar'
|
|
138
139
|
| 'stl'
|
|
139
140
|
| 'chm'
|
|
140
|
-
| '3mf'
|
|
141
|
+
| '3mf'
|
|
142
|
+
| 'zst'
|
|
143
|
+
| 'jxl'
|
|
144
|
+
| 'vcf';
|
|
141
145
|
|
|
142
146
|
type MimeType =
|
|
143
147
|
| 'image/jpeg'
|
|
@@ -145,6 +149,7 @@ declare namespace core {
|
|
|
145
149
|
| 'image/gif'
|
|
146
150
|
| 'image/webp'
|
|
147
151
|
| 'image/flif'
|
|
152
|
+
| 'image/x-xcf'
|
|
148
153
|
| 'image/x-canon-cr2'
|
|
149
154
|
| 'image/x-canon-cr3'
|
|
150
155
|
| 'image/tiff'
|
|
@@ -237,6 +242,7 @@ declare namespace core {
|
|
|
237
242
|
| 'application/dicom'
|
|
238
243
|
| 'audio/x-musepack'
|
|
239
244
|
| 'text/calendar'
|
|
245
|
+
| 'text/vcard'
|
|
240
246
|
| 'model/gltf-binary'
|
|
241
247
|
| 'application/vnd.tcpdump.pcap'
|
|
242
248
|
| 'audio/x-dsf' // Non-standard
|
|
@@ -268,7 +274,9 @@ declare namespace core {
|
|
|
268
274
|
| 'application/x-asar'
|
|
269
275
|
| 'model/stl'
|
|
270
276
|
| 'application/vnd.ms-htmlhelp'
|
|
271
|
-
| 'model/3mf'
|
|
277
|
+
| 'model/3mf'
|
|
278
|
+
| 'image/jxl'
|
|
279
|
+
| 'application/zstd';
|
|
272
280
|
|
|
273
281
|
interface FileTypeResult {
|
|
274
282
|
/**
|
|
@@ -345,7 +353,7 @@ declare namespace core {
|
|
|
345
353
|
/**
|
|
346
354
|
Supported MIME types.
|
|
347
355
|
*/
|
|
348
|
-
const mimeTypes:
|
|
356
|
+
const mimeTypes: Set<core.MimeType>;
|
|
349
357
|
|
|
350
358
|
/**
|
|
351
359
|
Detect the file type of a readable stream.
|
|
@@ -376,4 +384,3 @@ declare namespace core {
|
|
|
376
384
|
}
|
|
377
385
|
|
|
378
386
|
export = core;
|
|
379
|
-
|
package/core.js
CHANGED
|
@@ -805,6 +805,13 @@ async function _fromTokenizer(tokenizer) {
|
|
|
805
805
|
};
|
|
806
806
|
}
|
|
807
807
|
|
|
808
|
+
if (check([0x28, 0xB5, 0x2F, 0xFD])) {
|
|
809
|
+
return {
|
|
810
|
+
ext: 'zst',
|
|
811
|
+
mime: 'application/zstd'
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
|
|
808
815
|
// -- 5-byte signatures --
|
|
809
816
|
|
|
810
817
|
if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
|
|
@@ -904,13 +911,6 @@ async function _fromTokenizer(tokenizer) {
|
|
|
904
911
|
};
|
|
905
912
|
}
|
|
906
913
|
|
|
907
|
-
if (checkString('BEGIN:')) {
|
|
908
|
-
return {
|
|
909
|
-
ext: 'ics',
|
|
910
|
-
mime: 'text/calendar'
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
|
|
914
914
|
if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
|
|
915
915
|
return {
|
|
916
916
|
ext: '7z',
|
|
@@ -1044,6 +1044,13 @@ async function _fromTokenizer(tokenizer) {
|
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
|
+
if (checkString('gimp xcf ')) {
|
|
1048
|
+
return {
|
|
1049
|
+
ext: 'xcf',
|
|
1050
|
+
mime: 'image/x-xcf'
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1047
1054
|
// -- 12-byte signatures --
|
|
1048
1055
|
|
|
1049
1056
|
if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {
|
|
@@ -1155,6 +1162,16 @@ async function _fromTokenizer(tokenizer) {
|
|
|
1155
1162
|
}
|
|
1156
1163
|
}
|
|
1157
1164
|
|
|
1165
|
+
if (
|
|
1166
|
+
check([0xFF, 0x0A]) ||
|
|
1167
|
+
check([0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A])
|
|
1168
|
+
) {
|
|
1169
|
+
return {
|
|
1170
|
+
ext: 'jxl',
|
|
1171
|
+
mime: 'image/jxl'
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1158
1175
|
// -- Unsafe signatures --
|
|
1159
1176
|
|
|
1160
1177
|
if (
|
|
@@ -1199,6 +1216,24 @@ async function _fromTokenizer(tokenizer) {
|
|
|
1199
1216
|
// Increase sample size from 12 to 256.
|
|
1200
1217
|
await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});
|
|
1201
1218
|
|
|
1219
|
+
// -- 15-byte signatures --
|
|
1220
|
+
|
|
1221
|
+
if (checkString('BEGIN:')) {
|
|
1222
|
+
if (checkString('VCARD', {offset: 6})) {
|
|
1223
|
+
return {
|
|
1224
|
+
ext: 'vcf',
|
|
1225
|
+
mime: 'text/vcard'
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
if (checkString('VCALENDAR', {offset: 6})) {
|
|
1230
|
+
return {
|
|
1231
|
+
ext: 'ics',
|
|
1232
|
+
mime: 'text/calendar'
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1202
1237
|
// `raf` is here just to keep all the raw image detectors together.
|
|
1203
1238
|
if (checkString('FUJIFILMCCD-RAW')) {
|
|
1204
1239
|
return {
|
|
@@ -1223,7 +1258,7 @@ async function _fromTokenizer(tokenizer) {
|
|
|
1223
1258
|
|
|
1224
1259
|
if (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR
|
|
1225
1260
|
const jsonSize = buffer.readUInt32LE(12);
|
|
1226
|
-
if (jsonSize > 12 &&
|
|
1261
|
+
if (jsonSize > 12 && buffer.length >= jsonSize + 16) {
|
|
1227
1262
|
try {
|
|
1228
1263
|
const header = buffer.slice(16, jsonSize + 16).toString();
|
|
1229
1264
|
const json = JSON.parse(header);
|
|
@@ -1334,50 +1369,47 @@ async function _fromTokenizer(tokenizer) {
|
|
|
1334
1369
|
};
|
|
1335
1370
|
}
|
|
1336
1371
|
|
|
1337
|
-
// Check
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
if (check([
|
|
1342
|
-
// Check for (ADTS) MPEG-2
|
|
1343
|
-
if (check([0x08], {offset: start + 1, mask: [0x08]})) {
|
|
1344
|
-
return {
|
|
1345
|
-
ext: 'aac',
|
|
1346
|
-
mime: 'audio/aac'
|
|
1347
|
-
};
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
// Must be (ADTS) MPEG-4
|
|
1372
|
+
// Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
|
|
1373
|
+
if (buffer.length >= 2 && check([0xFF, 0xE0], {offset: 0, mask: [0xFF, 0xE0]})) {
|
|
1374
|
+
if (check([0x10], {offset: 1, mask: [0x16]})) {
|
|
1375
|
+
// Check for (ADTS) MPEG-2
|
|
1376
|
+
if (check([0x08], {offset: 1, mask: [0x08]})) {
|
|
1351
1377
|
return {
|
|
1352
1378
|
ext: 'aac',
|
|
1353
1379
|
mime: 'audio/aac'
|
|
1354
1380
|
};
|
|
1355
1381
|
}
|
|
1356
1382
|
|
|
1357
|
-
//
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1383
|
+
// Must be (ADTS) MPEG-4
|
|
1384
|
+
return {
|
|
1385
|
+
ext: 'aac',
|
|
1386
|
+
mime: 'audio/aac'
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1365
1389
|
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1390
|
+
// MPEG 1 or 2 Layer 3 header
|
|
1391
|
+
// Check for MPEG layer 3
|
|
1392
|
+
if (check([0x02], {offset: 1, mask: [0x06]})) {
|
|
1393
|
+
return {
|
|
1394
|
+
ext: 'mp3',
|
|
1395
|
+
mime: 'audio/mpeg'
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1373
1398
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1399
|
+
// Check for MPEG layer 2
|
|
1400
|
+
if (check([0x04], {offset: 1, mask: [0x06]})) {
|
|
1401
|
+
return {
|
|
1402
|
+
ext: 'mp2',
|
|
1403
|
+
mime: 'audio/mpeg'
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
// Check for MPEG layer 1
|
|
1408
|
+
if (check([0x06], {offset: 1, mask: [0x06]})) {
|
|
1409
|
+
return {
|
|
1410
|
+
ext: 'mp1',
|
|
1411
|
+
mime: 'audio/mpeg'
|
|
1412
|
+
};
|
|
1381
1413
|
}
|
|
1382
1414
|
}
|
|
1383
1415
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.5.1",
|
|
4
4
|
"description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"gif",
|
|
55
55
|
"webp",
|
|
56
56
|
"flif",
|
|
57
|
+
"xcf",
|
|
57
58
|
"cr2",
|
|
58
59
|
"cr3",
|
|
59
60
|
"orf",
|
|
@@ -181,7 +182,10 @@
|
|
|
181
182
|
"asar",
|
|
182
183
|
"stl",
|
|
183
184
|
"chm",
|
|
184
|
-
"3mf"
|
|
185
|
+
"3mf",
|
|
186
|
+
"zst",
|
|
187
|
+
"jxl",
|
|
188
|
+
"vcf"
|
|
185
189
|
],
|
|
186
190
|
"devDependencies": {
|
|
187
191
|
"@types/node": "^13.1.4",
|
|
@@ -194,8 +198,7 @@
|
|
|
194
198
|
"dependencies": {
|
|
195
199
|
"readable-web-to-node-stream": "^3.0.0",
|
|
196
200
|
"strtok3": "^6.0.3",
|
|
197
|
-
"token-types": "^2.0.0"
|
|
198
|
-
"typedarray-to-buffer": "^3.1.5"
|
|
201
|
+
"token-types": "^2.0.0"
|
|
199
202
|
},
|
|
200
203
|
"xo": {
|
|
201
204
|
"envs": [
|
package/readme.md
CHANGED
|
@@ -6,6 +6,36 @@ 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
|
+
<br>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
<p>
|
|
15
|
+
<p>
|
|
16
|
+
<sup>
|
|
17
|
+
<a href="https://github.com/sponsors/sindresorhus">My open source work is supported by the community</a>
|
|
18
|
+
</sup>
|
|
19
|
+
</p>
|
|
20
|
+
<sup>Special thanks to:</sup>
|
|
21
|
+
<br>
|
|
22
|
+
<br>
|
|
23
|
+
<a href="https://bit.io/?utm_campaign=github_repo&utm_medium=referral&utm_content=file-type&utm_source=github">
|
|
24
|
+
<div>
|
|
25
|
+
<img src="https://sindresorhus.com/assets/thanks/bitio-logo.svg" width="190" alt="bit.io">
|
|
26
|
+
</div>
|
|
27
|
+
<b>Instant, shareable cloud PostgreSQL database</b>
|
|
28
|
+
<div>
|
|
29
|
+
<sup>Import any dataset in seconds, share with anyone with a click, try without signing up</sup>
|
|
30
|
+
</div>
|
|
31
|
+
</a>
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
<br>
|
|
38
|
+
|
|
9
39
|
## Install
|
|
10
40
|
|
|
11
41
|
```
|
|
@@ -272,12 +302,13 @@ Returns a set of supported MIME types.
|
|
|
272
302
|
|
|
273
303
|
## Supported file types
|
|
274
304
|
|
|
275
|
-
- [`jpg`](https://en.wikipedia.org/wiki/JPEG)
|
|
276
|
-
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics)
|
|
305
|
+
- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
|
|
306
|
+
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
|
|
277
307
|
- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics
|
|
278
|
-
- [`gif`](https://en.wikipedia.org/wiki/GIF)
|
|
279
|
-
- [`webp`](https://en.wikipedia.org/wiki/WebP)
|
|
280
|
-
- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format)
|
|
308
|
+
- [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format
|
|
309
|
+
- [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format
|
|
310
|
+
- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format
|
|
311
|
+
- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility
|
|
281
312
|
- [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2)
|
|
282
313
|
- [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3)
|
|
283
314
|
- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file
|
|
@@ -286,92 +317,94 @@ Returns a set of supported MIME types.
|
|
|
286
317
|
- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file
|
|
287
318
|
- [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file
|
|
288
319
|
- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file
|
|
289
|
-
- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format)
|
|
290
|
-
- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format)
|
|
291
|
-
- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format)
|
|
292
|
-
- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR)
|
|
293
|
-
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format)
|
|
294
|
-
- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format)
|
|
295
|
-
- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format))
|
|
296
|
-
- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format)
|
|
297
|
-
- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format))
|
|
298
|
-
- [`gz`](https://en.wikipedia.org/wiki/Gzip)
|
|
299
|
-
- [`bz2`](https://en.wikipedia.org/wiki/Bzip2)
|
|
300
|
-
- [`
|
|
301
|
-
- [`
|
|
302
|
-
- [`
|
|
303
|
-
- [`
|
|
304
|
-
- [`
|
|
305
|
-
- [`
|
|
306
|
-
- [`
|
|
307
|
-
- [`
|
|
308
|
-
- [`
|
|
320
|
+
- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file
|
|
321
|
+
- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file
|
|
322
|
+
- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image
|
|
323
|
+
- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range
|
|
324
|
+
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
|
|
325
|
+
- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
|
|
326
|
+
- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file
|
|
327
|
+
- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tarball archive file
|
|
328
|
+
- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file
|
|
329
|
+
- [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file
|
|
330
|
+
- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file
|
|
331
|
+
- [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file
|
|
332
|
+
- [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive
|
|
333
|
+
- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
|
|
334
|
+
- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file
|
|
335
|
+
- [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file
|
|
336
|
+
- [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file
|
|
337
|
+
- [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file
|
|
338
|
+
- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file
|
|
339
|
+
- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file
|
|
340
|
+
- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file
|
|
309
341
|
- [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I
|
|
310
|
-
- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II)
|
|
311
|
-
- [`mp3`](https://en.wikipedia.org/wiki/MP3)
|
|
312
|
-
- [`ogg`](https://en.wikipedia.org/wiki/Ogg)
|
|
313
|
-
- [`ogv`](https://en.wikipedia.org/wiki/Ogg)
|
|
314
|
-
- [`ogm`](https://en.wikipedia.org/wiki/Ogg)
|
|
315
|
-
- [`oga`](https://en.wikipedia.org/wiki/Ogg)
|
|
316
|
-
- [`spx`](https://en.wikipedia.org/wiki/Ogg)
|
|
317
|
-
- [`ogx`](https://en.wikipedia.org/wiki/Ogg)
|
|
318
|
-
- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format))
|
|
319
|
-
- [`flac`](https://en.wikipedia.org/wiki/FLAC)
|
|
320
|
-
- [`wav`](https://en.wikipedia.org/wiki/WAV)
|
|
321
|
-
- [`qcp`](https://en.wikipedia.org/wiki/QCP)
|
|
322
|
-
- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec)
|
|
323
|
-
- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format)
|
|
324
|
-
- [`epub`](https://en.wikipedia.org/wiki/EPUB)
|
|
342
|
+
- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II
|
|
343
|
+
- [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file
|
|
344
|
+
- [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
345
|
+
- [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
346
|
+
- [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
347
|
+
- [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
348
|
+
- [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
349
|
+
- [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
|
350
|
+
- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file
|
|
351
|
+
- [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec
|
|
352
|
+
- [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file
|
|
353
|
+
- [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data
|
|
354
|
+
- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec
|
|
355
|
+
- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
|
|
356
|
+
- [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file
|
|
325
357
|
- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket
|
|
326
|
-
- [`exe`](https://en.wikipedia.org/wiki/.exe)
|
|
327
|
-
- [`swf`](https://en.wikipedia.org/wiki/SWF)
|
|
328
|
-
- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format)
|
|
329
|
-
- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format)
|
|
330
|
-
- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format)
|
|
331
|
-
- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType)
|
|
332
|
-
- [`ttf`](https://en.wikipedia.org/wiki/TrueType)
|
|
333
|
-
- [`otf`](https://en.wikipedia.org/wiki/OpenType)
|
|
334
|
-
- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format))
|
|
335
|
-
- [`flv`](https://en.wikipedia.org/wiki/Flash_Video)
|
|
336
|
-
- [`ps`](https://en.wikipedia.org/wiki/Postscript)
|
|
337
|
-
- [`xz`](https://en.wikipedia.org/wiki/Xz)
|
|
338
|
-
- [`sqlite`](https://www.sqlite.org/fileformat2.html)
|
|
339
|
-
- [`nes`](https://fileinfo.com/extension/nes)
|
|
340
|
-
- [`crx`](https://developer.chrome.com/extensions/crx)
|
|
341
|
-
- [`xpi`](https://en.wikipedia.org/wiki/XPInstall)
|
|
342
|
-
- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format))
|
|
343
|
-
- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format))
|
|
344
|
-
- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix))
|
|
345
|
-
- [`rpm`](https://fileinfo.com/extension/rpm)
|
|
346
|
-
- [`Z`](https://fileinfo.com/extension/z)
|
|
347
|
-
- [`lz`](https://en.wikipedia.org/wiki/Lzip)
|
|
348
|
-
- [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format)
|
|
349
|
-
- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format)
|
|
350
|
-
- [`mts`](https://en.wikipedia.org/wiki/.m2ts)
|
|
351
|
-
- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly)
|
|
352
|
-
- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format)
|
|
353
|
-
- [`bpg`](https://bellard.org/bpg/)
|
|
354
|
-
- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML)
|
|
355
|
-
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML)
|
|
356
|
-
- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML)
|
|
358
|
+
- [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file
|
|
359
|
+
- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file
|
|
360
|
+
- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format
|
|
361
|
+
- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
|
|
362
|
+
- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
|
|
363
|
+
- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font
|
|
364
|
+
- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font
|
|
365
|
+
- [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font
|
|
366
|
+
- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file
|
|
367
|
+
- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video
|
|
368
|
+
- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
|
|
369
|
+
- [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file
|
|
370
|
+
- [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file
|
|
371
|
+
- [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM
|
|
372
|
+
- [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension
|
|
373
|
+
- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file
|
|
374
|
+
- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file
|
|
375
|
+
- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package
|
|
376
|
+
- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file
|
|
377
|
+
- [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file
|
|
378
|
+
- [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File
|
|
379
|
+
- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Arhive file
|
|
380
|
+
- [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compount File Binary Format
|
|
381
|
+
- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format
|
|
382
|
+
- [`mts`](https://en.wikipedia.org/wiki/.m2ts) - Blu-ray Disc Audio-Video MPEG-2 Transport Stream
|
|
383
|
+
- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format
|
|
384
|
+
- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project
|
|
385
|
+
- [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file
|
|
386
|
+
- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word
|
|
387
|
+
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Powerpoint
|
|
388
|
+
- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel
|
|
357
389
|
- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
358
390
|
- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
359
391
|
- [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
360
392
|
- [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000
|
|
361
|
-
- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format)
|
|
393
|
+
- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file
|
|
362
394
|
- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing
|
|
363
395
|
- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets
|
|
364
396
|
- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations
|
|
365
|
-
- [`xml`](https://en.wikipedia.org/wiki/XML)
|
|
366
|
-
- [`heic`](https://nokiatech.github.io/heif/technical.html)
|
|
367
|
-
- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format))
|
|
368
|
-
- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/)
|
|
397
|
+
- [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language
|
|
398
|
+
- [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format
|
|
399
|
+
- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file
|
|
400
|
+
- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures
|
|
369
401
|
- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio
|
|
370
402
|
- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack
|
|
371
403
|
- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format
|
|
372
404
|
- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File
|
|
373
405
|
- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8)
|
|
374
406
|
- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
|
|
407
|
+
- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard
|
|
375
408
|
- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format
|
|
376
409
|
- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format
|
|
377
410
|
- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
|
|
@@ -406,6 +439,7 @@ Returns a set of supported MIME types.
|
|
|
406
439
|
- [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only)
|
|
407
440
|
- [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help
|
|
408
441
|
- [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format
|
|
442
|
+
- [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format
|
|
409
443
|
|
|
410
444
|
*Pull requests are welcome for additional commonly used file types.*
|
|
411
445
|
|
package/supported.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = {
|
|
|
8
8
|
'gif',
|
|
9
9
|
'webp',
|
|
10
10
|
'flif',
|
|
11
|
+
'xcf',
|
|
11
12
|
'cr2',
|
|
12
13
|
'cr3',
|
|
13
14
|
'orf',
|
|
@@ -135,7 +136,10 @@ module.exports = {
|
|
|
135
136
|
'asar',
|
|
136
137
|
'stl',
|
|
137
138
|
'chm',
|
|
138
|
-
'3mf'
|
|
139
|
+
'3mf',
|
|
140
|
+
'zst',
|
|
141
|
+
'jxl',
|
|
142
|
+
'vcf'
|
|
139
143
|
],
|
|
140
144
|
mimeTypes: [
|
|
141
145
|
'image/jpeg',
|
|
@@ -143,6 +147,7 @@ module.exports = {
|
|
|
143
147
|
'image/gif',
|
|
144
148
|
'image/webp',
|
|
145
149
|
'image/flif',
|
|
150
|
+
'image/x-xcf',
|
|
146
151
|
'image/x-canon-cr2',
|
|
147
152
|
'image/x-canon-cr3',
|
|
148
153
|
'image/tiff',
|
|
@@ -235,6 +240,7 @@ module.exports = {
|
|
|
235
240
|
'application/dicom',
|
|
236
241
|
'audio/x-musepack',
|
|
237
242
|
'text/calendar',
|
|
243
|
+
'text/vcard',
|
|
238
244
|
'model/gltf-binary',
|
|
239
245
|
'application/vnd.tcpdump.pcap',
|
|
240
246
|
'audio/x-dsf', // Non-standard
|
|
@@ -266,6 +272,8 @@ module.exports = {
|
|
|
266
272
|
'application/x-asar',
|
|
267
273
|
'model/stl',
|
|
268
274
|
'application/vnd.ms-htmlhelp',
|
|
269
|
-
'model/3mf'
|
|
275
|
+
'model/3mf',
|
|
276
|
+
'image/jxl',
|
|
277
|
+
'application/zstd'
|
|
270
278
|
]
|
|
271
279
|
};
|