file-type 19.5.0 → 20.0.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 +36 -333
- package/core.js +324 -243
- package/index.d.ts +9 -3
- package/index.js +14 -8
- package/package.json +28 -9
- package/readme.md +89 -28
- package/supported.js +37 -1
package/index.d.ts
CHANGED
|
@@ -4,8 +4,14 @@ Typings for Node.js specific entry point.
|
|
|
4
4
|
|
|
5
5
|
import type {Readable as NodeReadableStream} from 'node:stream';
|
|
6
6
|
import type {AnyWebByteStream} from 'strtok3';
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
type FileTypeResult,
|
|
9
|
+
type StreamOptions,
|
|
10
|
+
type AnyWebReadableStream,
|
|
11
|
+
type Detector,
|
|
12
|
+
type AnyWebReadableByteStreamWithFileType,
|
|
13
|
+
FileTypeParser as DefaultFileTypeParser,
|
|
14
|
+
} from './core.js';
|
|
9
15
|
|
|
10
16
|
export type ReadableStreamWithFileType = NodeReadableStream & {
|
|
11
17
|
readonly fileType?: FileTypeResult;
|
|
@@ -14,7 +20,7 @@ export type ReadableStreamWithFileType = NodeReadableStream & {
|
|
|
14
20
|
/**
|
|
15
21
|
Extending `FileTypeParser` with Node.js engine specific functions.
|
|
16
22
|
*/
|
|
17
|
-
export declare class
|
|
23
|
+
export declare class FileTypeParser extends DefaultFileTypeParser {
|
|
18
24
|
/**
|
|
19
25
|
@param stream - Node.js `stream.Readable` or web `ReadableStream`.
|
|
20
26
|
*/
|
package/index.js
CHANGED
|
@@ -5,13 +5,13 @@ Node.js specific entry point.
|
|
|
5
5
|
import {ReadableStream as WebReadableStream} from 'node:stream/web';
|
|
6
6
|
import {pipeline, PassThrough, Readable} from 'node:stream';
|
|
7
7
|
import * as strtok3 from 'strtok3';
|
|
8
|
-
import {FileTypeParser, reasonableDetectionSizeInBytes} from './core.js';
|
|
8
|
+
import {FileTypeParser as DefaultFileTypeParser, reasonableDetectionSizeInBytes} from './core.js';
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class FileTypeParser extends DefaultFileTypeParser {
|
|
11
11
|
async fromStream(stream) {
|
|
12
|
-
const tokenizer = await (stream instanceof WebReadableStream ? strtok3.fromWebStream(stream) : strtok3.fromStream(stream));
|
|
12
|
+
const tokenizer = await (stream instanceof WebReadableStream ? strtok3.fromWebStream(stream, this.tokenizerOptions) : strtok3.fromStream(stream, this.tokenizerOptions));
|
|
13
13
|
try {
|
|
14
|
-
return super.fromTokenizer(tokenizer);
|
|
14
|
+
return await super.fromTokenizer(tokenizer);
|
|
15
15
|
} finally {
|
|
16
16
|
await tokenizer.close();
|
|
17
17
|
}
|
|
@@ -66,15 +66,21 @@ export class NodeFileTypeParser extends FileTypeParser {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export async function fileTypeFromFile(path, fileTypeOptions) {
|
|
69
|
-
return (new
|
|
69
|
+
return (new FileTypeParser(fileTypeOptions)).fromFile(path, fileTypeOptions);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export async function fileTypeFromStream(stream, fileTypeOptions) {
|
|
73
|
-
return (new
|
|
73
|
+
return (new FileTypeParser(fileTypeOptions)).fromStream(stream);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export async function fileTypeStream(readableStream, options = {}) {
|
|
77
|
-
return new
|
|
77
|
+
return new FileTypeParser(options).toDetectionStream(readableStream, options);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export {
|
|
80
|
+
export {
|
|
81
|
+
fileTypeFromTokenizer,
|
|
82
|
+
fileTypeFromBuffer,
|
|
83
|
+
fileTypeFromBlob,
|
|
84
|
+
supportedMimeTypes,
|
|
85
|
+
supportedExtensions,
|
|
86
|
+
} from './core.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "Detect the file type of a file, stream, or data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -216,22 +216,41 @@
|
|
|
216
216
|
"icc",
|
|
217
217
|
"fbx",
|
|
218
218
|
"vsdx",
|
|
219
|
-
"vtt"
|
|
219
|
+
"vtt",
|
|
220
|
+
"apk",
|
|
221
|
+
"drc",
|
|
222
|
+
"lz4",
|
|
223
|
+
"potx",
|
|
224
|
+
"xltx",
|
|
225
|
+
"dotx",
|
|
226
|
+
"xltm",
|
|
227
|
+
"ots",
|
|
228
|
+
"odg",
|
|
229
|
+
"otg",
|
|
230
|
+
"otp",
|
|
231
|
+
"ott",
|
|
232
|
+
"xlsm",
|
|
233
|
+
"docm",
|
|
234
|
+
"dotm",
|
|
235
|
+
"potm",
|
|
236
|
+
"pptm",
|
|
237
|
+
"jar"
|
|
220
238
|
],
|
|
221
239
|
"dependencies": {
|
|
222
|
-
"
|
|
223
|
-
"strtok3": "^
|
|
240
|
+
"@tokenizer/inflate": "^0.2.6",
|
|
241
|
+
"strtok3": "^10.0.1",
|
|
224
242
|
"token-types": "^6.0.0",
|
|
225
|
-
"uint8array-extras": "^1.
|
|
243
|
+
"uint8array-extras": "^1.4.0"
|
|
226
244
|
},
|
|
227
245
|
"devDependencies": {
|
|
228
246
|
"@tokenizer/token": "^0.3.0",
|
|
229
|
-
"@types/node": "^
|
|
247
|
+
"@types/node": "^22.10.5",
|
|
230
248
|
"ava": "^6.0.1",
|
|
231
|
-
"commonmark": "^0.
|
|
249
|
+
"commonmark": "^0.31.2",
|
|
250
|
+
"get-stream": "^9.0.1",
|
|
232
251
|
"noop-stream": "^1.0.0",
|
|
233
|
-
"tsd": "^0.
|
|
234
|
-
"xo": "^0.
|
|
252
|
+
"tsd": "^0.31.2",
|
|
253
|
+
"xo": "^0.60.0"
|
|
235
254
|
},
|
|
236
255
|
"xo": {
|
|
237
256
|
"envs": [
|
package/readme.md
CHANGED
|
@@ -16,13 +16,13 @@ We accept contributions for commonly used modern file formats, not historical or
|
|
|
16
16
|
npm install file-type
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
**This package is an ESM package. Your project needs to be ESM too. [Read more](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).**
|
|
19
|
+
**This package is an ESM package. Your project needs to be ESM too. [Read more](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). For TypeScript + CommonJS, see [`load-esm`](https://github.com/Borewit/load-esm).**
|
|
20
20
|
|
|
21
21
|
If you use it with Webpack, you need the latest Webpack version and ensure you configure it correctly for ESM.
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
### Node.js
|
|
26
26
|
|
|
27
27
|
Determine file type from a file:
|
|
28
28
|
|
|
@@ -91,7 +91,7 @@ const write = fs.createWriteStream(`decrypted.${streamWithFileType.fileType.ext}
|
|
|
91
91
|
streamWithFileType.pipe(write);
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
### Browser
|
|
95
95
|
|
|
96
96
|
```js
|
|
97
97
|
import {fileTypeFromStream} from 'file-type';
|
|
@@ -178,10 +178,10 @@ A readable stream representing file data.
|
|
|
178
178
|
|
|
179
179
|
Detect the file type of a [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob),
|
|
180
180
|
|
|
181
|
-
[!TIP]
|
|
181
|
+
> [!TIP]
|
|
182
182
|
> A [`File` object](https://developer.mozilla.org/docs/Web/API/File) is a `Blob` and can be passed in here.
|
|
183
183
|
|
|
184
|
-
It will **stream** the underlying Blob
|
|
184
|
+
It will **stream** the underlying Blob.
|
|
185
185
|
|
|
186
186
|
The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the blob.
|
|
187
187
|
|
|
@@ -204,6 +204,21 @@ console.log(await fileTypeFromBlob(blob));
|
|
|
204
204
|
//=> {ext: 'txt', mime: 'text/plain'}
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
> [!WARNING]
|
|
208
|
+
> This method depends on [ReadableStreamBYOBReader](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader) which **requires Node.js ≥ 20**
|
|
209
|
+
> and [may not be available in all modern browsers](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader#browser_compatibility).
|
|
210
|
+
|
|
211
|
+
To work around this limitation, you can use an alternative approach to read and process the `Blob` without relying on streaming:
|
|
212
|
+
|
|
213
|
+
```js
|
|
214
|
+
import {fileTypeFromBuffer} from 'file-type';
|
|
215
|
+
|
|
216
|
+
async function readFromBlobWithoutStreaming(blob) {
|
|
217
|
+
const buffer = await blob.arrayBuffer();
|
|
218
|
+
return fileTypeFromBuffer(buffer);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
207
222
|
#### blob
|
|
208
223
|
|
|
209
224
|
Type: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
@@ -325,46 +340,74 @@ Returns a `Set<string>` of supported MIME types.
|
|
|
325
340
|
|
|
326
341
|
## Custom detectors
|
|
327
342
|
|
|
328
|
-
A custom
|
|
343
|
+
A custom file type detector.
|
|
344
|
+
|
|
345
|
+
Detectors can be added via the constructor options or by directly modifying `FileTypeParser#detectors`.
|
|
329
346
|
|
|
330
|
-
|
|
331
|
-
In Node.js, you should use `NodeFileTypeParser`, which extends `FileTypeParser` and provides access to Node.js specific functions.
|
|
347
|
+
Detectors provided through the constructor options are executed before the default detectors.
|
|
332
348
|
|
|
333
|
-
|
|
349
|
+
Custom detectors allow for:
|
|
350
|
+
- Introducing new `FileTypeResult` entries.
|
|
351
|
+
- Modifying the detection behavior of existing `FileTypeResult` types.
|
|
334
352
|
|
|
335
|
-
|
|
353
|
+
### Detector execution flow
|
|
336
354
|
|
|
337
|
-
If
|
|
355
|
+
If a detector returns `undefined`, the following rules apply:
|
|
338
356
|
|
|
339
|
-
1.
|
|
340
|
-
2.
|
|
341
|
-
In that case no further detectors will be executed and the final conclusion is that file-type returns undefined.
|
|
342
|
-
Note that this an exceptional scenario, as the detector takes the opportunity from any other detector to determine the file type.
|
|
357
|
+
1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
|
|
358
|
+
2. **Tokenizer Interaction**: If the detector modifies the tokenizer's position (`tokenizer.position` is advanced), no further detectors are executed. In this case, the file type remains `undefined`, as subsequent detectors cannot evaluate the content. This is an exceptional scenario, as it prevents any other detectors from determining the file type.
|
|
343
359
|
|
|
344
|
-
Example
|
|
360
|
+
### Example usage
|
|
361
|
+
|
|
362
|
+
Below is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.
|
|
345
363
|
|
|
346
364
|
```js
|
|
347
|
-
import {FileTypeParser} from 'file-type';
|
|
365
|
+
import {FileTypeParser} from 'file-type';
|
|
348
366
|
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
367
|
+
const unicornDetector = {
|
|
368
|
+
id: 'unicorn', // May be used to recognize the detector in the detector list
|
|
369
|
+
async detect(tokenizer) {
|
|
370
|
+
const unicornHeader = [85, 78, 73, 67, 79, 82, 78]; // "UNICORN" in ASCII decimal
|
|
352
371
|
|
|
353
|
-
const buffer = new Uint8Array(
|
|
372
|
+
const buffer = new Uint8Array(unicornHeader.length);
|
|
354
373
|
await tokenizer.peekBuffer(buffer, {length: unicornHeader.length, mayBeLess: true});
|
|
355
|
-
|
|
356
374
|
if (unicornHeader.every((value, index) => value === buffer[index])) {
|
|
357
375
|
return {ext: 'unicorn', mime: 'application/unicorn'};
|
|
358
376
|
}
|
|
359
377
|
|
|
360
378
|
return undefined;
|
|
361
|
-
}
|
|
362
|
-
|
|
379
|
+
}
|
|
380
|
+
}
|
|
363
381
|
|
|
364
|
-
const buffer = new Uint8Array(
|
|
365
|
-
const parser = new FileTypeParser({customDetectors});
|
|
382
|
+
const buffer = new Uint8Array([85, 78, 73, 67, 79, 82, 78]);
|
|
383
|
+
const parser = new FileTypeParser({customDetectors: [unicornDetector]});
|
|
366
384
|
const fileType = await parser.fromBuffer(buffer);
|
|
367
|
-
console.log(fileType);
|
|
385
|
+
console.log(fileType); // {ext: 'unicorn', mime: 'application/unicorn'}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
```ts
|
|
389
|
+
/**
|
|
390
|
+
@param tokenizer - The [tokenizer](https://github.com/Borewit/strtok3#tokenizer) used to read file content.
|
|
391
|
+
@param fileType - The file type detected by standard or previous custom detectors, or `undefined` if no match is found.
|
|
392
|
+
@returns The detected file type, or `undefined` if no match is found.
|
|
393
|
+
*/
|
|
394
|
+
export type Detector = (tokenizer: ITokenizer, fileType?: FileTypeResult) => Promise<FileTypeResult | undefined>;
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Abort signal
|
|
398
|
+
|
|
399
|
+
Some async operations can be aborted by passing an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to the `FileTypeParser` constructor.
|
|
400
|
+
|
|
401
|
+
```js
|
|
402
|
+
import {FileTypeParser} from 'file-type';
|
|
403
|
+
|
|
404
|
+
const abortController = new AbortController()
|
|
405
|
+
|
|
406
|
+
const parser = new FileTypeParser({abortSignal: abortController.signal});
|
|
407
|
+
|
|
408
|
+
const promise = parser.fromStream(blob.stream());
|
|
409
|
+
|
|
410
|
+
abortController.abort(); // Abort file-type reading from the Blob stream.
|
|
368
411
|
```
|
|
369
412
|
|
|
370
413
|
## Supported file types
|
|
@@ -382,6 +425,7 @@ console.log(fileType);
|
|
|
382
425
|
- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file
|
|
383
426
|
- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec
|
|
384
427
|
- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio
|
|
428
|
+
- [`apk`](https://en.wikipedia.org/wiki/Apk_(file_format)) - Android package format
|
|
385
429
|
- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics
|
|
386
430
|
- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file
|
|
387
431
|
- [`arj`](https://en.wikipedia.org/wiki/ARJ) - Archive file
|
|
@@ -409,7 +453,11 @@ console.log(fileType);
|
|
|
409
453
|
- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package
|
|
410
454
|
- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
|
|
411
455
|
- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file
|
|
456
|
+
- [`docm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled document
|
|
412
457
|
- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document
|
|
458
|
+
- [`dotm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled template
|
|
459
|
+
- [`dotx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word template
|
|
460
|
+
- [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression
|
|
413
461
|
- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
|
|
414
462
|
- [`dwg`](https://en.wikipedia.org/wiki/.dwg) - Autodesk CAD file
|
|
415
463
|
- [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format
|
|
@@ -436,6 +484,7 @@ console.log(fileType);
|
|
|
436
484
|
- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
|
|
437
485
|
- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker
|
|
438
486
|
- [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
487
|
+
- [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive
|
|
439
488
|
- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images
|
|
440
489
|
- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
441
490
|
- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
|
|
@@ -446,6 +495,7 @@ console.log(fileType);
|
|
|
446
495
|
- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures
|
|
447
496
|
- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut
|
|
448
497
|
- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Archive file
|
|
498
|
+
- [`lz4`](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) - Compressed archive created by one of a variety of LZ4 compression utilities
|
|
449
499
|
- [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive
|
|
450
500
|
- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files
|
|
451
501
|
- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks
|
|
@@ -468,6 +518,7 @@ console.log(fileType);
|
|
|
468
518
|
- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format
|
|
469
519
|
- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file
|
|
470
520
|
- [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM
|
|
521
|
+
- [`odg`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for drawing
|
|
471
522
|
- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations
|
|
472
523
|
- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets
|
|
473
524
|
- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing
|
|
@@ -479,12 +530,19 @@ console.log(fileType);
|
|
|
479
530
|
- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file
|
|
480
531
|
- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file
|
|
481
532
|
- [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font
|
|
533
|
+
- [`otg`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for drawing
|
|
534
|
+
- [`otp`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for presentations
|
|
535
|
+
- [`ots`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for spreadsheets
|
|
536
|
+
- [`ott`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for word processing
|
|
482
537
|
- [`parquet`](https://en.wikipedia.org/wiki/Apache_Parquet) - Apache Parquet
|
|
483
538
|
- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format
|
|
484
539
|
- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
|
|
485
540
|
- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy
|
|
486
541
|
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
|
|
487
|
-
- [`
|
|
542
|
+
- [`potm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled template
|
|
543
|
+
- [`potx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint template
|
|
544
|
+
- [`pptm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled document
|
|
545
|
+
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft PowerPoint document
|
|
488
546
|
- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
|
|
489
547
|
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
|
|
490
548
|
- [`pst`](https://en.wikipedia.org/wiki/Personal_Storage_Table) - Personal Storage Table file
|
|
@@ -516,7 +574,10 @@ console.log(fileType);
|
|
|
516
574
|
- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
|
|
517
575
|
- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack
|
|
518
576
|
- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility
|
|
577
|
+
- [`xlsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled document
|
|
519
578
|
- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel document
|
|
579
|
+
- [`xltm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled template
|
|
580
|
+
- [`xltx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel template
|
|
520
581
|
- [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2
|
|
521
582
|
- [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language
|
|
522
583
|
- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file
|
package/supported.js
CHANGED
|
@@ -153,6 +153,24 @@ export const extensions = [
|
|
|
153
153
|
'fbx',
|
|
154
154
|
'vsdx',
|
|
155
155
|
'vtt',
|
|
156
|
+
'apk',
|
|
157
|
+
'drc',
|
|
158
|
+
'lz4',
|
|
159
|
+
'potx',
|
|
160
|
+
'xltx',
|
|
161
|
+
'dotx',
|
|
162
|
+
'xltm',
|
|
163
|
+
'ott',
|
|
164
|
+
'ots',
|
|
165
|
+
'otp',
|
|
166
|
+
'odg',
|
|
167
|
+
'otg',
|
|
168
|
+
'xlsm',
|
|
169
|
+
'docm',
|
|
170
|
+
'dotm',
|
|
171
|
+
'potm',
|
|
172
|
+
'pptm',
|
|
173
|
+
'jar',
|
|
156
174
|
];
|
|
157
175
|
|
|
158
176
|
export const mimeTypes = [
|
|
@@ -200,9 +218,9 @@ export const mimeTypes = [
|
|
|
200
218
|
'video/3gpp',
|
|
201
219
|
'audio/mpeg',
|
|
202
220
|
'audio/mp4', // RFC 4337
|
|
203
|
-
'audio/opus',
|
|
204
221
|
'video/ogg',
|
|
205
222
|
'audio/ogg',
|
|
223
|
+
'audio/ogg; codecs=opus',
|
|
206
224
|
'application/ogg',
|
|
207
225
|
'audio/x-flac',
|
|
208
226
|
'audio/ape',
|
|
@@ -305,4 +323,22 @@ export const mimeTypes = [
|
|
|
305
323
|
'application/vnd.iccprofile',
|
|
306
324
|
'application/x.autodesk.fbx', // Invented by us
|
|
307
325
|
'application/vnd.visio',
|
|
326
|
+
'application/vnd.android.package-archive',
|
|
327
|
+
'application/vnd.google.draco', // Invented by us
|
|
328
|
+
'application/x-lz4', // Invented by us
|
|
329
|
+
'application/vnd.openxmlformats-officedocument.presentationml.template',
|
|
330
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
|
331
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
|
332
|
+
'application/vnd.ms-excel.template.macroenabled.12',
|
|
333
|
+
'application/vnd.oasis.opendocument.text-template',
|
|
334
|
+
'application/vnd.oasis.opendocument.spreadsheet-template',
|
|
335
|
+
'application/vnd.oasis.opendocument.presentation-template',
|
|
336
|
+
'application/vnd.oasis.opendocument.graphics',
|
|
337
|
+
'application/vnd.oasis.opendocument.graphics-template',
|
|
338
|
+
'application/vnd.ms-excel.sheet.macroEnabled.12',
|
|
339
|
+
'application/vnd.ms-word.document.macroEnabled.12',
|
|
340
|
+
'application/vnd.ms-word.template.macroEnabled.12',
|
|
341
|
+
'application/vnd.ms-powerpoint.template.macroEnabled.12',
|
|
342
|
+
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
|
343
|
+
'application/java-archive',
|
|
308
344
|
];
|