file-type 16.0.1 → 16.4.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 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'
@@ -135,7 +136,11 @@ declare namespace core {
135
136
  | 'lzh'
136
137
  | 'pgp'
137
138
  | 'asar'
138
- | 'stl';
139
+ | 'stl'
140
+ | 'chm'
141
+ | '3mf'
142
+ | 'zst'
143
+ | 'vcf';
139
144
 
140
145
  type MimeType =
141
146
  | 'image/jpeg'
@@ -143,6 +148,7 @@ declare namespace core {
143
148
  | 'image/gif'
144
149
  | 'image/webp'
145
150
  | 'image/flif'
151
+ | 'image/x-xcf'
146
152
  | 'image/x-canon-cr2'
147
153
  | 'image/x-canon-cr3'
148
154
  | 'image/tiff'
@@ -235,6 +241,7 @@ declare namespace core {
235
241
  | 'application/dicom'
236
242
  | 'audio/x-musepack'
237
243
  | 'text/calendar'
244
+ | 'text/vcard'
238
245
  | 'model/gltf-binary'
239
246
  | 'application/vnd.tcpdump.pcap'
240
247
  | 'audio/x-dsf' // Non-standard
@@ -264,7 +271,10 @@ declare namespace core {
264
271
  | 'application/x-lzh-compressed'
265
272
  | 'application/pgp-encrypted'
266
273
  | 'application/x-asar'
267
- | 'model/stl';
274
+ | 'model/stl'
275
+ | 'application/vnd.ms-htmlhelp'
276
+ | 'model/3mf'
277
+ | 'application/zstd';
268
278
 
269
279
  interface FileTypeResult {
270
280
  /**
@@ -372,4 +382,3 @@ declare namespace core {
372
382
  }
373
383
 
374
384
  export = core;
375
-
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])) {
@@ -880,6 +888,13 @@ async function _fromTokenizer(tokenizer) {
880
888
  }
881
889
  }
882
890
 
891
+ if (checkString('ITSF')) {
892
+ return {
893
+ ext: 'chm',
894
+ mime: 'application/vnd.ms-htmlhelp'
895
+ };
896
+ }
897
+
883
898
  // -- 6-byte signatures --
884
899
 
885
900
  if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {
@@ -896,13 +911,6 @@ async function _fromTokenizer(tokenizer) {
896
911
  };
897
912
  }
898
913
 
899
- if (checkString('BEGIN:')) {
900
- return {
901
- ext: 'ics',
902
- mime: 'text/calendar'
903
- };
904
- }
905
-
906
914
  if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
907
915
  return {
908
916
  ext: '7z',
@@ -1036,6 +1044,13 @@ async function _fromTokenizer(tokenizer) {
1036
1044
  };
1037
1045
  }
1038
1046
 
1047
+ if (checkString('gimp xcf ')) {
1048
+ return {
1049
+ ext: 'xcf',
1050
+ mime: 'image/x-xcf'
1051
+ };
1052
+ }
1053
+
1039
1054
  // -- 12-byte signatures --
1040
1055
 
1041
1056
  if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {
@@ -1191,6 +1206,24 @@ async function _fromTokenizer(tokenizer) {
1191
1206
  // Increase sample size from 12 to 256.
1192
1207
  await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});
1193
1208
 
1209
+ // -- 15-byte signatures --
1210
+
1211
+ if (checkString('BEGIN:')) {
1212
+ if (checkString('VCARD', {offset: 6})) {
1213
+ return {
1214
+ ext: 'vcf',
1215
+ mime: 'text/vcard'
1216
+ };
1217
+ }
1218
+
1219
+ if (checkString('VCALENDAR', {offset: 6})) {
1220
+ return {
1221
+ ext: 'ics',
1222
+ mime: 'text/calendar'
1223
+ };
1224
+ }
1225
+ }
1226
+
1194
1227
  // `raf` is here just to keep all the raw image detectors together.
1195
1228
  if (checkString('FUJIFILMCCD-RAW')) {
1196
1229
  return {
@@ -1326,50 +1359,47 @@ async function _fromTokenizer(tokenizer) {
1326
1359
  };
1327
1360
  }
1328
1361
 
1329
- // Check for MPEG header at different starting offsets
1330
- for (let start = 0; start < 2 && start < (buffer.length - 16); start++) {
1331
- // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
1332
- if (buffer.length >= start + 2 && check([0xFF, 0xE0], {offset: start, mask: [0xFF, 0xE0]})) {
1333
- if (check([0x10], {offset: start + 1, mask: [0x16]})) {
1334
- // Check for (ADTS) MPEG-2
1335
- if (check([0x08], {offset: start + 1, mask: [0x08]})) {
1336
- return {
1337
- ext: 'aac',
1338
- mime: 'audio/aac'
1339
- };
1340
- }
1341
-
1342
- // Must be (ADTS) MPEG-4
1362
+ // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
1363
+ if (buffer.length >= 2 && check([0xFF, 0xE0], {offset: 0, mask: [0xFF, 0xE0]})) {
1364
+ if (check([0x10], {offset: 1, mask: [0x16]})) {
1365
+ // Check for (ADTS) MPEG-2
1366
+ if (check([0x08], {offset: 1, mask: [0x08]})) {
1343
1367
  return {
1344
1368
  ext: 'aac',
1345
1369
  mime: 'audio/aac'
1346
1370
  };
1347
1371
  }
1348
1372
 
1349
- // MPEG 1 or 2 Layer 3 header
1350
- // Check for MPEG layer 3
1351
- if (check([0x02], {offset: start + 1, mask: [0x06]})) {
1352
- return {
1353
- ext: 'mp3',
1354
- mime: 'audio/mpeg'
1355
- };
1356
- }
1373
+ // Must be (ADTS) MPEG-4
1374
+ return {
1375
+ ext: 'aac',
1376
+ mime: 'audio/aac'
1377
+ };
1378
+ }
1357
1379
 
1358
- // Check for MPEG layer 2
1359
- if (check([0x04], {offset: start + 1, mask: [0x06]})) {
1360
- return {
1361
- ext: 'mp2',
1362
- mime: 'audio/mpeg'
1363
- };
1364
- }
1380
+ // MPEG 1 or 2 Layer 3 header
1381
+ // Check for MPEG layer 3
1382
+ if (check([0x02], {offset: 1, mask: [0x06]})) {
1383
+ return {
1384
+ ext: 'mp3',
1385
+ mime: 'audio/mpeg'
1386
+ };
1387
+ }
1365
1388
 
1366
- // Check for MPEG layer 1
1367
- if (check([0x06], {offset: start + 1, mask: [0x06]})) {
1368
- return {
1369
- ext: 'mp1',
1370
- mime: 'audio/mpeg'
1371
- };
1372
- }
1389
+ // Check for MPEG layer 2
1390
+ if (check([0x04], {offset: 1, mask: [0x06]})) {
1391
+ return {
1392
+ ext: 'mp2',
1393
+ mime: 'audio/mpeg'
1394
+ };
1395
+ }
1396
+
1397
+ // Check for MPEG layer 1
1398
+ if (check([0x06], {offset: 1, mask: [0x06]})) {
1399
+ return {
1400
+ ext: 'mp1',
1401
+ mime: 'audio/mpeg'
1402
+ };
1373
1403
  }
1374
1404
  }
1375
1405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-type",
3
- "version": "16.0.1",
3
+ "version": "16.4.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",
@@ -179,7 +180,11 @@
179
180
  "lzh",
180
181
  "pgp",
181
182
  "asar",
182
- "stl"
183
+ "stl",
184
+ "chm",
185
+ "3mf",
186
+ "zst",
187
+ "vcf"
183
188
  ],
184
189
  "devDependencies": {
185
190
  "@types/node": "^13.1.4",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # file-type [![Build Status](https://travis-ci.com/sindresorhus/file-type.svg?branch=master)](https://travis-ci.com/github/sindresorhus/file-type)
1
+ # file-type
2
2
 
3
3
  > Detect the file type of a Buffer/Uint8Array/ArrayBuffer
4
4
 
@@ -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)
@@ -404,13 +407,15 @@ Returns a set of supported MIME types.
404
407
  - [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy
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)
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
407
412
 
408
413
  *Pull requests are welcome for additional commonly used file types.*
409
414
 
410
415
  The following file types will not be accepted:
411
416
  - [MS-CFB: Microsoft Compound File Binary File Format based formats](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/53989ce4-7b05-4f8d-829b-d08d6148375b), too old and difficult to parse:
412
- - `.doc` - Microsoft Word 97-2003 Document
413
- - `.xls` - Microsoft Excel 97-2003 Document
417
+ - `.doc` - Microsoft Word 97-2003 Document
418
+ - `.xls` - Microsoft Excel 97-2003 Document
414
419
  - `.ppt` - Microsoft PowerPoint97-2003 Document
415
420
  - `.msi` - Microsoft Windows Installer
416
421
  - `.csv` - [Reason.](https://github.com/sindresorhus/file-type/issues/264#issuecomment-568439196)
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',
@@ -133,7 +134,11 @@ module.exports = {
133
134
  'lzh',
134
135
  'pgp',
135
136
  'asar',
136
- 'stl'
137
+ 'stl',
138
+ 'chm',
139
+ '3mf',
140
+ 'zst',
141
+ 'vcf'
137
142
  ],
138
143
  mimeTypes: [
139
144
  'image/jpeg',
@@ -141,6 +146,7 @@ module.exports = {
141
146
  'image/gif',
142
147
  'image/webp',
143
148
  'image/flif',
149
+ 'image/x-xcf',
144
150
  'image/x-canon-cr2',
145
151
  'image/x-canon-cr3',
146
152
  'image/tiff',
@@ -233,6 +239,7 @@ module.exports = {
233
239
  'application/dicom',
234
240
  'audio/x-musepack',
235
241
  'text/calendar',
242
+ 'text/vcard',
236
243
  'model/gltf-binary',
237
244
  'application/vnd.tcpdump.pcap',
238
245
  'audio/x-dsf', // Non-standard
@@ -262,6 +269,9 @@ module.exports = {
262
269
  'application/x-lzh-compressed',
263
270
  'application/pgp-encrypted',
264
271
  'application/x-asar',
265
- 'model/stl'
272
+ 'model/stl',
273
+ 'application/vnd.ms-htmlhelp',
274
+ 'model/3mf',
275
+ 'application/zstd'
266
276
  ]
267
277
  };