file-type 16.1.0 → 16.5.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/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 convertBlobToBuffer(blob);
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 Web API File to Node Buffer.
18
+ Convert Blobs to ArrayBuffer.
20
19
  @param {Blob} blob - Web API Blob.
21
- @returns {Promise<Buffer>}
20
+ @returns {Promise<ArrayBuffer>}
22
21
  */
23
- function convertBlobToBuffer(blob) {
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
- let data = event.target.result;
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'
@@ -136,7 +137,11 @@ declare namespace core {
136
137
  | 'pgp'
137
138
  | 'asar'
138
139
  | 'stl'
139
- | 'chm';
140
+ | 'chm'
141
+ | '3mf'
142
+ | 'zst'
143
+ | 'jxl'
144
+ | 'vcf';
140
145
 
141
146
  type MimeType =
142
147
  | 'image/jpeg'
@@ -144,6 +149,7 @@ declare namespace core {
144
149
  | 'image/gif'
145
150
  | 'image/webp'
146
151
  | 'image/flif'
152
+ | 'image/x-xcf'
147
153
  | 'image/x-canon-cr2'
148
154
  | 'image/x-canon-cr3'
149
155
  | 'image/tiff'
@@ -236,6 +242,7 @@ declare namespace core {
236
242
  | 'application/dicom'
237
243
  | 'audio/x-musepack'
238
244
  | 'text/calendar'
245
+ | 'text/vcard'
239
246
  | 'model/gltf-binary'
240
247
  | 'application/vnd.tcpdump.pcap'
241
248
  | 'audio/x-dsf' // Non-standard
@@ -266,7 +273,10 @@ declare namespace core {
266
273
  | 'application/pgp-encrypted'
267
274
  | 'application/x-asar'
268
275
  | 'model/stl'
269
- | 'application/vnd.ms-htmlhelp';
276
+ | 'application/vnd.ms-htmlhelp'
277
+ | 'model/3mf'
278
+ | 'image/jxl'
279
+ | 'application/zstd';
270
280
 
271
281
  interface FileTypeResult {
272
282
  /**
@@ -374,4 +384,3 @@ declare namespace core {
374
384
  }
375
385
 
376
386
  export = core;
377
-
package/core.js CHANGED
@@ -55,15 +55,6 @@ function _check(buffer, headers, options) {
55
55
  return true;
56
56
  }
57
57
 
58
- async function _checkSequence(sequence, tokenizer, ignoreBytes) {
59
- const buffer = Buffer.alloc(minimumBytes);
60
- await tokenizer.ignore(ignoreBytes);
61
-
62
- await tokenizer.peekBuffer(buffer, {mayBeLess: true});
63
-
64
- return buffer.includes(Buffer.from(sequence));
65
- }
66
-
67
58
  async function fromTokenizer(tokenizer) {
68
59
  try {
69
60
  return _fromTokenizer(tokenizer);
@@ -79,7 +70,6 @@ async function _fromTokenizer(tokenizer) {
79
70
  const bytesRead = 12;
80
71
  const check = (header, options) => _check(buffer, header, options);
81
72
  const checkString = (header, options) => check(stringToBytes(header), options);
82
- const checkSequence = (sequence, ignoreBytes) => _checkSequence(sequence, tokenizer, ignoreBytes);
83
73
 
84
74
  // Keep reading until EOF if the file size is unknown.
85
75
  if (!tokenizer.fileInfo.size) {
@@ -318,6 +308,13 @@ async function _fromTokenizer(tokenizer) {
318
308
  };
319
309
  }
320
310
 
311
+ if (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) {
312
+ return {
313
+ ext: '3mf',
314
+ mime: 'model/3mf'
315
+ };
316
+ }
317
+
321
318
  // The docx, xlsx and pptx file types extend the Office Open XML file format:
322
319
  // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
323
320
  // We look for:
@@ -589,9 +586,13 @@ async function _fromTokenizer(tokenizer) {
589
586
  }
590
587
 
591
588
  if (checkString('%PDF')) {
589
+ await tokenizer.ignore(1350);
590
+ const maxBufferSize = 10 * 1024 * 1024;
591
+ const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size));
592
+ await tokenizer.readBuffer(buffer, {mayBeLess: true});
593
+
592
594
  // Check if this is an Adobe Illustrator file
593
- const isAiFile = await checkSequence('Adobe Illustrator', 1350);
594
- if (isAiFile) {
595
+ if (buffer.includes(Buffer.from('AIPrivateData'))) {
595
596
  return {
596
597
  ext: 'ai',
597
598
  mime: 'application/postscript'
@@ -804,6 +805,13 @@ async function _fromTokenizer(tokenizer) {
804
805
  };
805
806
  }
806
807
 
808
+ if (check([0x28, 0xB5, 0x2F, 0xFD])) {
809
+ return {
810
+ ext: 'zst',
811
+ mime: 'application/zstd'
812
+ };
813
+ }
814
+
807
815
  // -- 5-byte signatures --
808
816
 
809
817
  if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
@@ -903,13 +911,6 @@ async function _fromTokenizer(tokenizer) {
903
911
  };
904
912
  }
905
913
 
906
- if (checkString('BEGIN:')) {
907
- return {
908
- ext: 'ics',
909
- mime: 'text/calendar'
910
- };
911
- }
912
-
913
914
  if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
914
915
  return {
915
916
  ext: '7z',
@@ -1043,6 +1044,13 @@ async function _fromTokenizer(tokenizer) {
1043
1044
  };
1044
1045
  }
1045
1046
 
1047
+ if (checkString('gimp xcf ')) {
1048
+ return {
1049
+ ext: 'xcf',
1050
+ mime: 'image/x-xcf'
1051
+ };
1052
+ }
1053
+
1046
1054
  // -- 12-byte signatures --
1047
1055
 
1048
1056
  if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {
@@ -1154,6 +1162,16 @@ async function _fromTokenizer(tokenizer) {
1154
1162
  }
1155
1163
  }
1156
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
+
1157
1175
  // -- Unsafe signatures --
1158
1176
 
1159
1177
  if (
@@ -1198,6 +1216,24 @@ async function _fromTokenizer(tokenizer) {
1198
1216
  // Increase sample size from 12 to 256.
1199
1217
  await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});
1200
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
+
1201
1237
  // `raf` is here just to keep all the raw image detectors together.
1202
1238
  if (checkString('FUJIFILMCCD-RAW')) {
1203
1239
  return {
@@ -1222,7 +1258,7 @@ async function _fromTokenizer(tokenizer) {
1222
1258
 
1223
1259
  if (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR
1224
1260
  const jsonSize = buffer.readUInt32LE(12);
1225
- if (jsonSize > 12 && jsonSize < 240 && buffer.length >= jsonSize + 16) {
1261
+ if (jsonSize > 12 && buffer.length >= jsonSize + 16) {
1226
1262
  try {
1227
1263
  const header = buffer.slice(16, jsonSize + 16).toString();
1228
1264
  const json = JSON.parse(header);
@@ -1333,50 +1369,47 @@ async function _fromTokenizer(tokenizer) {
1333
1369
  };
1334
1370
  }
1335
1371
 
1336
- // Check for MPEG header at different starting offsets
1337
- for (let start = 0; start < 2 && start < (buffer.length - 16); start++) {
1338
- // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
1339
- if (buffer.length >= start + 2 && check([0xFF, 0xE0], {offset: start, mask: [0xFF, 0xE0]})) {
1340
- if (check([0x10], {offset: start + 1, mask: [0x16]})) {
1341
- // Check for (ADTS) MPEG-2
1342
- if (check([0x08], {offset: start + 1, mask: [0x08]})) {
1343
- return {
1344
- ext: 'aac',
1345
- mime: 'audio/aac'
1346
- };
1347
- }
1348
-
1349
- // 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]})) {
1350
1377
  return {
1351
1378
  ext: 'aac',
1352
1379
  mime: 'audio/aac'
1353
1380
  };
1354
1381
  }
1355
1382
 
1356
- // MPEG 1 or 2 Layer 3 header
1357
- // Check for MPEG layer 3
1358
- if (check([0x02], {offset: start + 1, mask: [0x06]})) {
1359
- return {
1360
- ext: 'mp3',
1361
- mime: 'audio/mpeg'
1362
- };
1363
- }
1383
+ // Must be (ADTS) MPEG-4
1384
+ return {
1385
+ ext: 'aac',
1386
+ mime: 'audio/aac'
1387
+ };
1388
+ }
1364
1389
 
1365
- // Check for MPEG layer 2
1366
- if (check([0x04], {offset: start + 1, mask: [0x06]})) {
1367
- return {
1368
- ext: 'mp2',
1369
- mime: 'audio/mpeg'
1370
- };
1371
- }
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
+ }
1372
1398
 
1373
- // Check for MPEG layer 1
1374
- if (check([0x06], {offset: start + 1, mask: [0x06]})) {
1375
- return {
1376
- ext: 'mp1',
1377
- mime: 'audio/mpeg'
1378
- };
1379
- }
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
+ };
1380
1413
  }
1381
1414
  }
1382
1415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-type",
3
- "version": "16.1.0",
3
+ "version": "16.5.0",
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",
@@ -180,7 +181,11 @@
180
181
  "pgp",
181
182
  "asar",
182
183
  "stl",
183
- "chm"
184
+ "chm",
185
+ "3mf",
186
+ "zst",
187
+ "jxl",
188
+ "vcf"
184
189
  ],
185
190
  "devDependencies": {
186
191
  "@types/node": "^13.1.4",
@@ -193,8 +198,7 @@
193
198
  "dependencies": {
194
199
  "readable-web-to-node-stream": "^3.0.0",
195
200
  "strtok3": "^6.0.3",
196
- "token-types": "^2.0.0",
197
- "typedarray-to-buffer": "^3.1.5"
201
+ "token-types": "^2.0.0"
198
202
  },
199
203
  "xo": {
200
204
  "envs": [
package/readme.md CHANGED
@@ -272,12 +272,13 @@ Returns a set of supported MIME types.
272
272
 
273
273
  ## Supported file types
274
274
 
275
- - [`jpg`](https://en.wikipedia.org/wiki/JPEG)
276
- - [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics)
275
+ - [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
276
+ - [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
277
277
  - [`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)
278
+ - [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format
279
+ - [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format
280
+ - [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format
281
+ - [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility
281
282
  - [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2)
282
283
  - [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3)
283
284
  - [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file
@@ -286,92 +287,94 @@ Returns a set of supported MIME types.
286
287
  - [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file
287
288
  - [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file
288
289
  - [`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
- - [`7z`](https://en.wikipedia.org/wiki/7z)
301
- - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image)
302
- - [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions)
303
- - [`mid`](https://en.wikipedia.org/wiki/MIDI)
304
- - [`mkv`](https://en.wikipedia.org/wiki/Matroska)
305
- - [`webm`](https://en.wikipedia.org/wiki/WebM)
306
- - [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format)
307
- - [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave)
308
- - [`mpg`](https://en.wikipedia.org/wiki/MPEG-1)
290
+ - [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file
291
+ - [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file
292
+ - [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image
293
+ - [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range
294
+ - [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
295
+ - [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
296
+ - [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file
297
+ - [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tarball archive file
298
+ - [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file
299
+ - [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file
300
+ - [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file
301
+ - [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file
302
+ - [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive
303
+ - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
304
+ - [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file
305
+ - [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file
306
+ - [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file
307
+ - [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file
308
+ - [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file
309
+ - [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file
310
+ - [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file
309
311
  - [`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)
312
+ - [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II
313
+ - [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file
314
+ - [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file
315
+ - [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file
316
+ - [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file
317
+ - [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file
318
+ - [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
319
+ - [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
320
+ - [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file
321
+ - [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec
322
+ - [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file
323
+ - [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data
324
+ - [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec
325
+ - [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
326
+ - [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file
325
327
  - [`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)
328
+ - [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file
329
+ - [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file
330
+ - [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format
331
+ - [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
332
+ - [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
333
+ - [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font
334
+ - [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font
335
+ - [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font
336
+ - [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file
337
+ - [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video
338
+ - [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
339
+ - [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file
340
+ - [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file
341
+ - [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM
342
+ - [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension
343
+ - [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file
344
+ - [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file
345
+ - [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package
346
+ - [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file
347
+ - [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file
348
+ - [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File
349
+ - [`lz`](https://en.wikipedia.org/wiki/Lzip) - Arhive file
350
+ - [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compount File Binary Format
351
+ - [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format
352
+ - [`mts`](https://en.wikipedia.org/wiki/.m2ts) - Blu-ray Disc Audio-Video MPEG-2 Transport Stream
353
+ - [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format
354
+ - [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project
355
+ - [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file
356
+ - [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word
357
+ - [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Powerpoint
358
+ - [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel
357
359
  - [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
358
360
  - [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
359
361
  - [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
360
362
  - [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000
361
- - [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format)
363
+ - [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file
362
364
  - [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing
363
365
  - [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets
364
366
  - [`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/)
367
+ - [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language
368
+ - [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format
369
+ - [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file
370
+ - [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures
369
371
  - [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio
370
372
  - [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack
371
373
  - [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format
372
374
  - [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File
373
375
  - [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8)
374
376
  - [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
377
+ - [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard
375
378
  - [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format
376
379
  - [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format
377
380
  - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
@@ -405,6 +408,8 @@ Returns a set of supported MIME types.
405
408
  - [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications
406
409
  - [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only)
407
410
  - [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help
411
+ - [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format
412
+ - [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format
408
413
 
409
414
  *Pull requests are welcome for additional commonly used file types.*
410
415
 
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',
@@ -134,7 +135,11 @@ module.exports = {
134
135
  'pgp',
135
136
  'asar',
136
137
  'stl',
137
- 'chm'
138
+ 'chm',
139
+ '3mf',
140
+ 'zst',
141
+ 'jxl',
142
+ 'vcf'
138
143
  ],
139
144
  mimeTypes: [
140
145
  'image/jpeg',
@@ -142,6 +147,7 @@ module.exports = {
142
147
  'image/gif',
143
148
  'image/webp',
144
149
  'image/flif',
150
+ 'image/x-xcf',
145
151
  'image/x-canon-cr2',
146
152
  'image/x-canon-cr3',
147
153
  'image/tiff',
@@ -234,6 +240,7 @@ module.exports = {
234
240
  'application/dicom',
235
241
  'audio/x-musepack',
236
242
  'text/calendar',
243
+ 'text/vcard',
237
244
  'model/gltf-binary',
238
245
  'application/vnd.tcpdump.pcap',
239
246
  'audio/x-dsf', // Non-standard
@@ -264,6 +271,9 @@ module.exports = {
264
271
  'application/pgp-encrypted',
265
272
  'application/x-asar',
266
273
  'model/stl',
267
- 'application/vnd.ms-htmlhelp'
274
+ 'application/vnd.ms-htmlhelp',
275
+ 'model/3mf',
276
+ 'image/jxl',
277
+ 'application/zstd'
268
278
  ]
269
279
  };