llonebot-dist 6.6.4

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.
Files changed (134) hide show
  1. dist/default_config.json +68 -0
  2. dist/llonebot.js +48348 -0
  3. dist/llonebot.js.map +1 -0
  4. dist/node_modules/@borewit/text-codec/LICENSE.txt +9 -0
  5. dist/node_modules/@borewit/text-codec/README.md +76 -0
  6. dist/node_modules/@borewit/text-codec/lib/index.d.ts +8 -0
  7. dist/node_modules/@borewit/text-codec/lib/index.js +161 -0
  8. dist/node_modules/@borewit/text-codec/package.json +68 -0
  9. dist/node_modules/@minatojs/sql.js/LICENSE +44 -0
  10. dist/node_modules/@minatojs/sql.js/README.md +357 -0
  11. dist/node_modules/@minatojs/sql.js/dist/sql-wasm.d.ts +316 -0
  12. dist/node_modules/@minatojs/sql.js/dist/sql-wasm.js +225 -0
  13. dist/node_modules/@minatojs/sql.js/dist/sql-wasm.wasm +0 -0
  14. dist/node_modules/@minatojs/sql.js/package.json +58 -0
  15. dist/node_modules/@tokenizer/inflate/LICENSE +15 -0
  16. dist/node_modules/@tokenizer/inflate/README.md +114 -0
  17. dist/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts +6 -0
  18. dist/node_modules/@tokenizer/inflate/lib/GzipHandler.js +19 -0
  19. dist/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts +26 -0
  20. dist/node_modules/@tokenizer/inflate/lib/ZipHandler.js +233 -0
  21. dist/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts +94 -0
  22. dist/node_modules/@tokenizer/inflate/lib/ZipToken.js +117 -0
  23. dist/node_modules/@tokenizer/inflate/lib/index.d.ts +3 -0
  24. dist/node_modules/@tokenizer/inflate/lib/index.js +2 -0
  25. dist/node_modules/@tokenizer/inflate/package.json +76 -0
  26. dist/node_modules/@tokenizer/token/README.md +19 -0
  27. dist/node_modules/@tokenizer/token/index.d.ts +30 -0
  28. dist/node_modules/@tokenizer/token/package.json +33 -0
  29. dist/node_modules/debug/LICENSE +20 -0
  30. dist/node_modules/debug/README.md +481 -0
  31. dist/node_modules/debug/package.json +64 -0
  32. dist/node_modules/debug/src/browser.js +272 -0
  33. dist/node_modules/debug/src/common.js +292 -0
  34. dist/node_modules/debug/src/index.js +10 -0
  35. dist/node_modules/debug/src/node.js +263 -0
  36. dist/node_modules/file-type/core.d.ts +253 -0
  37. dist/node_modules/file-type/core.js +1899 -0
  38. dist/node_modules/file-type/index.d.ts +98 -0
  39. dist/node_modules/file-type/index.js +86 -0
  40. dist/node_modules/file-type/license +9 -0
  41. dist/node_modules/file-type/package.json +288 -0
  42. dist/node_modules/file-type/readme.md +674 -0
  43. dist/node_modules/file-type/supported.js +356 -0
  44. dist/node_modules/file-type/util.js +60 -0
  45. dist/node_modules/ieee754/LICENSE +11 -0
  46. dist/node_modules/ieee754/README.md +51 -0
  47. dist/node_modules/ieee754/index.d.ts +10 -0
  48. dist/node_modules/ieee754/index.js +85 -0
  49. dist/node_modules/ieee754/package.json +52 -0
  50. dist/node_modules/ms/index.js +162 -0
  51. dist/node_modules/ms/license.md +21 -0
  52. dist/node_modules/ms/package.json +38 -0
  53. dist/node_modules/ms/readme.md +59 -0
  54. dist/node_modules/silk-wasm/LICENSE +21 -0
  55. dist/node_modules/silk-wasm/README.md +85 -0
  56. dist/node_modules/silk-wasm/lib/index.cjs +16 -0
  57. dist/node_modules/silk-wasm/lib/index.d.ts +70 -0
  58. dist/node_modules/silk-wasm/lib/index.mjs +16 -0
  59. dist/node_modules/silk-wasm/lib/silk.wasm +0 -0
  60. dist/node_modules/silk-wasm/lib/utils.d.ts +4 -0
  61. dist/node_modules/silk-wasm/package.json +39 -0
  62. dist/node_modules/strtok3/LICENSE.txt +21 -0
  63. dist/node_modules/strtok3/README.md +399 -0
  64. dist/node_modules/strtok3/lib/AbstractTokenizer.d.ts +76 -0
  65. dist/node_modules/strtok3/lib/AbstractTokenizer.js +108 -0
  66. dist/node_modules/strtok3/lib/BlobTokenizer.d.ts +29 -0
  67. dist/node_modules/strtok3/lib/BlobTokenizer.js +53 -0
  68. dist/node_modules/strtok3/lib/BufferTokenizer.d.ts +29 -0
  69. dist/node_modules/strtok3/lib/BufferTokenizer.js +52 -0
  70. dist/node_modules/strtok3/lib/FileTokenizer.d.ts +37 -0
  71. dist/node_modules/strtok3/lib/FileTokenizer.js +61 -0
  72. dist/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +31 -0
  73. dist/node_modules/strtok3/lib/ReadStreamTokenizer.js +102 -0
  74. dist/node_modules/strtok3/lib/core.d.ts +40 -0
  75. dist/node_modules/strtok3/lib/core.js +62 -0
  76. dist/node_modules/strtok3/lib/index.d.ts +16 -0
  77. dist/node_modules/strtok3/lib/index.js +22 -0
  78. dist/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +54 -0
  79. dist/node_modules/strtok3/lib/stream/AbstractStreamReader.js +71 -0
  80. dist/node_modules/strtok3/lib/stream/Deferred.d.ts +6 -0
  81. dist/node_modules/strtok3/lib/stream/Deferred.js +10 -0
  82. dist/node_modules/strtok3/lib/stream/Errors.d.ts +10 -0
  83. dist/node_modules/strtok3/lib/stream/Errors.js +16 -0
  84. dist/node_modules/strtok3/lib/stream/StreamReader.d.ts +29 -0
  85. dist/node_modules/strtok3/lib/stream/StreamReader.js +83 -0
  86. dist/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +14 -0
  87. dist/node_modules/strtok3/lib/stream/WebStreamByobReader.js +27 -0
  88. dist/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +19 -0
  89. dist/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +62 -0
  90. dist/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +14 -0
  91. dist/node_modules/strtok3/lib/stream/WebStreamReader.js +13 -0
  92. dist/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +5 -0
  93. dist/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +19 -0
  94. dist/node_modules/strtok3/lib/stream/index.d.ts +6 -0
  95. dist/node_modules/strtok3/lib/stream/index.js +5 -0
  96. dist/node_modules/strtok3/lib/types.d.ts +139 -0
  97. dist/node_modules/strtok3/lib/types.js +1 -0
  98. dist/node_modules/strtok3/package.json +94 -0
  99. dist/node_modules/token-types/LICENSE.txt +9 -0
  100. dist/node_modules/token-types/README.md +120 -0
  101. dist/node_modules/token-types/lib/index.d.ts +135 -0
  102. dist/node_modules/token-types/lib/index.js +401 -0
  103. dist/node_modules/token-types/package.json +81 -0
  104. dist/node_modules/uint8array-extras/index.d.ts +312 -0
  105. dist/node_modules/uint8array-extras/index.js +321 -0
  106. dist/node_modules/uint8array-extras/license +9 -0
  107. dist/node_modules/uint8array-extras/package.json +54 -0
  108. dist/node_modules/uint8array-extras/readme.md +301 -0
  109. dist/node_modules/ws/LICENSE +20 -0
  110. dist/node_modules/ws/README.md +548 -0
  111. dist/node_modules/ws/browser.js +8 -0
  112. dist/node_modules/ws/index.js +13 -0
  113. dist/node_modules/ws/lib/buffer-util.js +131 -0
  114. dist/node_modules/ws/lib/constants.js +18 -0
  115. dist/node_modules/ws/lib/event-target.js +292 -0
  116. dist/node_modules/ws/lib/extension.js +203 -0
  117. dist/node_modules/ws/lib/limiter.js +55 -0
  118. dist/node_modules/ws/lib/permessage-deflate.js +528 -0
  119. dist/node_modules/ws/lib/receiver.js +706 -0
  120. dist/node_modules/ws/lib/sender.js +602 -0
  121. dist/node_modules/ws/lib/stream.js +161 -0
  122. dist/node_modules/ws/lib/subprotocol.js +62 -0
  123. dist/node_modules/ws/lib/validation.js +152 -0
  124. dist/node_modules/ws/lib/websocket-server.js +550 -0
  125. dist/node_modules/ws/lib/websocket.js +1388 -0
  126. dist/node_modules/ws/package.json +69 -0
  127. dist/node_modules/ws/wrapper.mjs +8 -0
  128. dist/package.json +1 -0
  129. dist/webui/assets/index-B9vGhdCO.js +256 -0
  130. dist/webui/assets/index-DaqFU7JR.css +1 -0
  131. dist/webui/index.html +13 -0
  132. dist/webui/logo.jpg +0 -0
  133. dist//344/275/277/347/224/250/350/257/264/346/230/216.txt +11 -0
  134. dist//346/233/264/346/226/260/346/227/245/345/277/227.txt +399 -0
@@ -0,0 +1,674 @@
1
+ <h1 align="center" title="file-type">
2
+ <img src="media/logo.jpg" alt="file-type logo">
3
+ </h1>
4
+
5
+ > Detect the file type of a file, stream, or data
6
+
7
+ The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.
8
+
9
+ This package is for detecting binary-based file formats, not text-based formats like `.txt`, `.csv`, `.svg`, etc.
10
+
11
+ We accept contributions for commonly used modern file formats, not historical or obscure ones. Open an issue first for discussion.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install file-type
17
+ ```
18
+
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
+
21
+ If you use it with Webpack, you need the latest Webpack version and ensure you configure it correctly for ESM.
22
+
23
+ File type detection is based on binary signatures (magic numbers) and should be treated as a best-effort hint, not a guarantee.
24
+
25
+ ## Usage
26
+
27
+ ### Node.js
28
+
29
+ Determine file type from a file:
30
+
31
+ ```js
32
+ import {fileTypeFromFile} from 'file-type';
33
+
34
+ console.log(await fileTypeFromFile('Unicorn.png'));
35
+ //=> {ext: 'png', mime: 'image/png'}
36
+ ```
37
+
38
+ Determine file type from a Uint8Array/ArrayBuffer, which may be a portion of the beginning of a file:
39
+
40
+ ```js
41
+ import {fileTypeFromBuffer} from 'file-type';
42
+ import {readChunk} from 'read-chunk';
43
+
44
+ const buffer = await readChunk('Unicorn.png', {length: 4100});
45
+
46
+ console.log(await fileTypeFromBuffer(buffer));
47
+ //=> {ext: 'png', mime: 'image/png'}
48
+ ```
49
+
50
+ Determine file type from a stream:
51
+
52
+ ```js
53
+ import fs from 'node:fs';
54
+ import {fileTypeFromStream} from 'file-type';
55
+
56
+ const stream = fs.createReadStream('Unicorn.mp4');
57
+
58
+ console.log(await fileTypeFromStream(stream));
59
+ //=> {ext: 'mp4', mime: 'video/mp4'}
60
+ ```
61
+
62
+ The stream method can also be used to read from a remote location:
63
+
64
+ ```js
65
+ import got from 'got';
66
+ import {fileTypeFromStream} from 'file-type';
67
+
68
+ const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';
69
+
70
+ const stream = got.stream(url);
71
+
72
+ console.log(await fileTypeFromStream(stream));
73
+ //=> {ext: 'jpg', mime: 'image/jpeg'}
74
+ ```
75
+
76
+ Another stream example:
77
+
78
+ ```js
79
+ import stream from 'node:stream';
80
+ import fs from 'node:fs';
81
+ import crypto from 'node:crypto';
82
+ import {fileTypeStream} from 'file-type';
83
+
84
+ const read = fs.createReadStream('encrypted.enc');
85
+ const decipher = crypto.createDecipheriv(alg, key, iv);
86
+
87
+ const streamWithFileType = await fileTypeStream(stream.pipeline(read, decipher));
88
+
89
+ console.log(streamWithFileType.fileType);
90
+ //=> {ext: 'mov', mime: 'video/quicktime'}
91
+
92
+ const write = fs.createWriteStream(`decrypted.${streamWithFileType.fileType.ext}`);
93
+ streamWithFileType.pipe(write);
94
+ ```
95
+
96
+ ### Browser
97
+
98
+ ```js
99
+ import {fileTypeFromStream} from 'file-type';
100
+
101
+ const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';
102
+
103
+ const response = await fetch(url);
104
+ const fileType = await fileTypeFromStream(response.body);
105
+
106
+ console.log(fileType);
107
+ //=> {ext: 'jpg', mime: 'image/jpeg'}
108
+ ```
109
+
110
+ ## API
111
+
112
+ ### fileTypeFromBuffer(buffer, options)
113
+
114
+ Detect the file type of a `Uint8Array`, or `ArrayBuffer`.
115
+
116
+ The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.
117
+
118
+ If file access is available, it is recommended to use `fileTypeFromFile()` instead.
119
+
120
+ Returns a `Promise` for an object with the detected file type:
121
+
122
+ - `ext` - One of the [supported file types](#supported-file-types)
123
+ - `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)
124
+
125
+ Or `undefined` when there is no match.
126
+
127
+ #### buffer
128
+
129
+ Type: `Uint8Array | ArrayBuffer`
130
+
131
+ A buffer representing file data. It works best if the buffer contains the entire file. It may work with a smaller portion as well.
132
+
133
+ ### fileTypeFromFile(filePath, options)
134
+
135
+ Detect the file type of a file path.
136
+
137
+ This is for Node.js only.
138
+
139
+ To read from a [`File`](https://developer.mozilla.org/docs/Web/API/File), see [`fileTypeFromBlob()`](#filetypefromblobblob-options).
140
+
141
+ The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.
142
+
143
+ Returns a `Promise` for an object with the detected file type:
144
+
145
+ - `ext` - One of the [supported file types](#supported-file-types)
146
+ - `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)
147
+
148
+ Or `undefined` when there is no match.
149
+
150
+ #### filePath
151
+
152
+ Type: `string`
153
+
154
+ The file path to parse.
155
+
156
+ ### fileTypeFromStream(stream)
157
+
158
+ Detect the file type of a [web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
159
+
160
+ If the engine is Node.js, this may also be a [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
161
+
162
+ Direct support for Node.js streams will be dropped in the future, when Node.js streams can be converted to Web streams (see [`toWeb()`](https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options)).
163
+
164
+ The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.
165
+
166
+ Returns a `Promise` for an object with the detected file type:
167
+
168
+ - `ext` - One of the [supported file types](#supported-file-types)
169
+ - `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)
170
+
171
+ Or `undefined` when there is no match.
172
+
173
+ #### stream
174
+
175
+ Type: [Web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) or [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)
176
+
177
+ A readable stream representing file data.
178
+
179
+ ### fileTypeFromBlob(blob, options)
180
+
181
+ Detect the file type of a [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob),
182
+
183
+ > [!TIP]
184
+ > A [`File` object](https://developer.mozilla.org/docs/Web/API/File) is a `Blob` and can be passed in here.
185
+
186
+ It will **stream** the underlying Blob.
187
+
188
+ 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.
189
+
190
+ Returns a `Promise` for an object with the detected file type:
191
+
192
+ - `ext` - One of the [supported file types](#supported-file-types)
193
+ - `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)
194
+
195
+ Or `undefined` when there is no match.
196
+
197
+ ```js
198
+ import {fileTypeFromBlob} from 'file-type';
199
+
200
+ const blob = new Blob(['<?xml version="1.0" encoding="ISO-8859-1" ?>'], {
201
+ type: 'text/plain',
202
+ endings: 'native'
203
+ });
204
+
205
+ console.log(await fileTypeFromBlob(blob));
206
+ //=> {ext: 'txt', mime: 'text/plain'}
207
+ ```
208
+
209
+ > [!WARNING]
210
+ > This method depends on [ReadableStreamBYOBReader](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader) which **requires Node.js ≥ 20**
211
+ > and [may not be available in all modern browsers](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader#browser_compatibility).
212
+
213
+ To work around this limitation, you can use an alternative approach to read and process the `Blob` without relying on streaming:
214
+
215
+ ```js
216
+ import {fileTypeFromBuffer} from 'file-type';
217
+
218
+ async function readFromBlobWithoutStreaming(blob) {
219
+ const buffer = await blob.arrayBuffer();
220
+ return fileTypeFromBuffer(buffer);
221
+ }
222
+ ```
223
+
224
+ #### blob
225
+
226
+ Type: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
227
+
228
+ ### fileTypeFromTokenizer(tokenizer, options)
229
+
230
+ Detect the file type from an `ITokenizer` source.
231
+
232
+ This method is used internally, but can also be used for a special "tokenizer" reader.
233
+
234
+ A tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used.
235
+
236
+ Returns a `Promise` for an object with the detected file type:
237
+
238
+ - `ext` - One of the [supported file types](#supported-file-types)
239
+ - `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)
240
+
241
+ Or `undefined` when there is no match.
242
+
243
+ An example is [`@tokenizer/http`](https://github.com/Borewit/tokenizer-http), which requests data using [HTTP-range-requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). A difference with a conventional stream and the [*tokenizer*](https://github.com/Borewit/strtok3#tokenizer), is that it can *ignore* (seek, fast-forward) in the stream. For example, you may only need and read the first 6 bytes, and the last 128 bytes, which may be an advantage in case reading the entire file would take longer.
244
+
245
+ ```js
246
+ import {makeTokenizer} from '@tokenizer/http';
247
+ import {fileTypeFromTokenizer} from 'file-type';
248
+
249
+ const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3';
250
+
251
+ const httpTokenizer = await makeTokenizer(audioTrackUrl);
252
+ const fileType = await fileTypeFromTokenizer(httpTokenizer);
253
+
254
+ console.log(fileType);
255
+ //=> {ext: 'mp3', mime: 'audio/mpeg'}
256
+ ```
257
+
258
+ Or use [`@tokenizer/s3`](https://github.com/Borewit/tokenizer-s3) to determine the file type of a file stored on [Amazon S3](https://aws.amazon.com/s3):
259
+
260
+ ```js
261
+ import {S3Client} from '@aws-sdk/client-s3';
262
+ import {makeChunkedTokenizerFromS3} from '@tokenizer/s3';
263
+ import {fileTypeFromTokenizer} from 'file-type';
264
+
265
+ // Initialize the S3 client
266
+ // Initialize S3 client
267
+ const s3 = new S3Client();
268
+
269
+ // Initialize the S3 tokenizer.
270
+ const s3Tokenizer = await makeChunkedTokenizerFromS3(s3, {
271
+ Bucket: 'affectlab',
272
+ Key: '1min_35sec.mp4'
273
+ });
274
+
275
+ // Figure out what kind of file it is.
276
+ const fileType = await fileTypeFromTokenizer(s3Tokenizer);
277
+ console.log(fileType);
278
+ ```
279
+
280
+ Note that only the minimum amount of data required to determine the file type is read (okay, just a bit extra to prevent too many fragmented reads).
281
+
282
+ #### tokenizer
283
+
284
+ Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer)
285
+
286
+ A file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer).
287
+
288
+ ### fileTypeStream(webStream, options?)
289
+
290
+ Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileTypeFromFile()`.
291
+
292
+ This method can be handy to put in between a stream, but it comes with a price.
293
+ Internally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample, to determine the file type.
294
+ The sample size impacts the file detection resolution.
295
+ A smaller sample size will result in lower probability of the best file type detection.
296
+
297
+ **Note:** When using Node.js, a `stream.Readable` may be provided as well.
298
+
299
+ #### readableStream
300
+
301
+ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)
302
+
303
+ #### options
304
+
305
+ Type: `object`
306
+
307
+ Supports the following options in addition to the [general options](#options):
308
+
309
+ ##### sampleSize
310
+
311
+ Type: `number`\
312
+ Default: `4100`
313
+
314
+ The sample size in bytes.
315
+
316
+ #### Example
317
+
318
+ ```js
319
+ import got from 'got';
320
+ import {fileTypeStream} from 'file-type';
321
+
322
+ const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';
323
+
324
+ const stream1 = got.stream(url);
325
+ const stream2 = await fileTypeStream(stream1, {sampleSize: 1024});
326
+
327
+ if (stream2.fileType?.mime === 'image/jpeg') {
328
+ // stream2 can be used to stream the JPEG image (from the very beginning of the stream)
329
+ }
330
+ ```
331
+
332
+ #### readableStream
333
+
334
+ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)
335
+
336
+ The input stream.
337
+
338
+ ### supportedExtensions
339
+
340
+ Returns a `Set<string>` of supported file extensions.
341
+
342
+ ### supportedMimeTypes
343
+
344
+ Returns a `Set<string>` of supported MIME types.
345
+
346
+ ### Options
347
+
348
+ #### customDetectors
349
+
350
+ Array of custom file type detectors to run before default detectors.
351
+
352
+ For example:
353
+
354
+ ```js
355
+ import {fileTypeFromFile} from 'file-type';
356
+ import {detectXml} from '@file-type/xml';
357
+
358
+ const fileType = await fileTypeFromFile('sample.kml', {customDetectors: [detectXml]});
359
+ console.log(fileType);
360
+ ```
361
+
362
+ #### mpegOffsetTolerance
363
+
364
+ Default: `0`
365
+
366
+ Specifies the byte tolerance for locating the first MPEG audio frame (e.g. `.mp1`, `.mp2`, `.mp3`, `.aac`).
367
+
368
+ Allows detection to handle slight sync offsets between the expected and actual frame start. Common in malformed or incorrectly muxed files, which, while technically invalid, do occur in the wild.
369
+
370
+ A tolerance of 10 bytes covers most cases.
371
+
372
+ ## Custom detectors
373
+
374
+ Custom file type detectors are plugins designed to extend the default detection capabilities.
375
+ They allow support for uncommon file types, non-binary formats, or customized detection behavior.
376
+
377
+ Detectors can be added via the constructor options or by modifying `FileTypeParser#detectors` directly.
378
+ Detectors provided through the constructor are executed before the default ones.
379
+
380
+ Detectors can be added via the constructor options or by directly modifying `FileTypeParser#detectors`.
381
+
382
+ ### Example adding a detector
383
+
384
+ For example:
385
+
386
+ ```js
387
+ import {FileTypeParser} from 'file-type';
388
+ import {detectXml} from '@file-type/xml';
389
+
390
+ const parser = new FileTypeParser({customDetectors: [detectXml]});
391
+ const fileType = await parser.fromFile('sample.kml');
392
+ console.log(fileType);
393
+ ```
394
+
395
+ ### Available third-party file-type detectors
396
+
397
+ - [@file-type/av](https://github.com/Borewit/file-type-av): Improves detection of audio and video file formats, with accurate differentiation between the two
398
+ - [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as GLM, KML, MusicXML, RSS, SVG, and XHTML
399
+
400
+ ### Detector execution flow
401
+
402
+ If a detector returns `undefined`, the following rules apply:
403
+
404
+ 1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.
405
+ 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.
406
+
407
+ ### Writing your own custom detector
408
+
409
+ Below is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.
410
+
411
+ ```js
412
+ import {FileTypeParser} from 'file-type';
413
+
414
+ const unicornDetector = {
415
+ id: 'unicorn', // May be used to recognize the detector in the detector list
416
+ async detect(tokenizer) {
417
+ const unicornHeader = [85, 78, 73, 67, 79, 82, 78]; // "UNICORN" in ASCII decimal
418
+
419
+ const buffer = new Uint8Array(unicornHeader.length);
420
+ await tokenizer.peekBuffer(buffer, {length: unicornHeader.length, mayBeLess: true});
421
+ if (unicornHeader.every((value, index) => value === buffer[index])) {
422
+ return {ext: 'unicorn', mime: 'application/unicorn'};
423
+ }
424
+
425
+ return undefined;
426
+ }
427
+ }
428
+
429
+ const buffer = new Uint8Array([85, 78, 73, 67, 79, 82, 78]);
430
+ const parser = new FileTypeParser({customDetectors: [unicornDetector]});
431
+ const fileType = await parser.fromBuffer(buffer);
432
+ console.log(fileType); // {ext: 'unicorn', mime: 'application/unicorn'}
433
+ ```
434
+
435
+ ```ts
436
+ /**
437
+ @param tokenizer - The [tokenizer](https://github.com/Borewit/strtok3#tokenizer) used to read file content.
438
+ @param fileType - The file type detected by standard or previous custom detectors, or `undefined` if no match is found.
439
+ @returns The detected file type, or `undefined` if no match is found.
440
+ */
441
+ export type Detector = (tokenizer: ITokenizer, fileType?: FileTypeResult) => Promise<FileTypeResult | undefined>;
442
+ ```
443
+
444
+ ## Abort signal
445
+
446
+ Some async operations can be aborted by passing an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to the `FileTypeParser` constructor.
447
+
448
+ ```js
449
+ import {FileTypeParser} from 'file-type';
450
+
451
+ const abortController = new AbortController()
452
+
453
+ const parser = new FileTypeParser({abortSignal: abortController.signal});
454
+
455
+ const promise = parser.fromStream(blob.stream());
456
+
457
+ abortController.abort(); // Abort file-type reading from the Blob stream.
458
+ ```
459
+
460
+ ## Supported file types
461
+
462
+ - [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services
463
+ - [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2#3GP) - Multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services
464
+ - [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format
465
+ - [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive
466
+ - [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File
467
+ - [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding
468
+ - [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File
469
+ - [`ace`](https://en.wikipedia.org/wiki/ACE_(compressed_file_format)) - ACE archive
470
+ - [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file
471
+ - [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file
472
+ - [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec
473
+ - [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio
474
+ - [`apk`](https://en.wikipedia.org/wiki/Apk_(file_format)) - Android package format
475
+ - [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics
476
+ - [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file
477
+ - [`arj`](https://en.wikipedia.org/wiki/ARJ) - Archive file
478
+ - [`arrow`](https://arrow.apache.org) - Columnar format for tables of data
479
+ - [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file
480
+ - [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications
481
+ - [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format
482
+ - [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file
483
+ - [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format
484
+ - [`avro`](https://en.wikipedia.org/wiki/Apache_Avro#Avro_Object_Container_File) - Object container file developed by Apache Avro
485
+ - [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project
486
+ - [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file
487
+ - [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file
488
+ - [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file
489
+ - [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file
490
+ - [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compound File Binary Format
491
+ - [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help
492
+ - [`class`](https://en.wikipedia.org/wiki/Java_class_file) - Java class file
493
+ - [`cpio`](https://en.wikipedia.org/wiki/Cpio) - Cpio archive
494
+ - [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2)
495
+ - [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3)
496
+ - [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension
497
+ - [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file
498
+ - [`dat`](https://en.wikipedia.org/wiki/Windows_Registry) - Windows registry hive file
499
+ - [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File
500
+ - [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package
501
+ - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
502
+ - [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file
503
+ - [`docm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled document
504
+ - [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document
505
+ - [`dotm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled template
506
+ - [`dotx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word template
507
+ - [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression
508
+ - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
509
+ - [`dwg`](https://en.wikipedia.org/wiki/.dwg) - Autodesk CAD file
510
+ - [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format
511
+ - [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font
512
+ - [`eps`](https://en.wikipedia.org/wiki/Encapsulated_PostScript) - Encapsulated PostScript
513
+ - [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file
514
+ - [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file
515
+ - [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player
516
+ - [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player
517
+ - [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player
518
+ - [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player
519
+ - [`fbx`](https://en.wikipedia.org/wiki/FBX) - Filmbox is a proprietary file format used to provide interoperability between digital content creation apps.
520
+ - [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec
521
+ - [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format
522
+ - [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video
523
+ - [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format
524
+ - [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format
525
+ - [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file
526
+ - [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format
527
+ - [`icc`](https://en.wikipedia.org/wiki/ICC_profile) - ICC Profile
528
+ - [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image
529
+ - [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file
530
+ - [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
531
+ - [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
532
+ - [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker
533
+ - [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
534
+ - [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive
535
+ - [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images
536
+ - [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
537
+ - [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
538
+ - [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
539
+ - [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
540
+ - [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format
541
+ - [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range
542
+ - [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures
543
+ - [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut
544
+ - [`lz`](https://en.wikipedia.org/wiki/Lzip) - Archive file
545
+ - [`lz4`](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) - Compressed archive created by one of a variety of LZ4 compression utilities
546
+ - [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive
547
+ - [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files
548
+ - [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks
549
+ - [`m4p`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as were sold through the iTunes Store
550
+ - [`m4v`](https://en.wikipedia.org/wiki/M4V) - Video container format developed by Apple, which is very similar to the MP4 format
551
+ - [`macho`](https://en.wikipedia.org/wiki/Mach-O) - Mach-O binary format
552
+ - [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file
553
+ - [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information
554
+ - [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000
555
+ - [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file
556
+ - [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket
557
+ - [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file
558
+ - [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I
559
+ - [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II
560
+ - [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file
561
+ - [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file
562
+ - [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8)
563
+ - [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file
564
+ - [`mts`](https://en.wikipedia.org/wiki/.m2ts) - MPEG-2 Transport Stream, both raw and Blu-ray Disc Audio-Video (BDAV) versions
565
+ - [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format
566
+ - [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file
567
+ - [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM
568
+ - [`odg`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for drawing
569
+ - [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations
570
+ - [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets
571
+ - [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing
572
+ - [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file
573
+ - [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file
574
+ - [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file
575
+ - [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file
576
+ - [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
577
+ - [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file
578
+ - [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file
579
+ - [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font
580
+ - [`otg`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for drawing
581
+ - [`otp`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for presentations
582
+ - [`ots`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for spreadsheets
583
+ - [`ott`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for word processing
584
+ - [`parquet`](https://en.wikipedia.org/wiki/Apache_Parquet) - Apache Parquet
585
+ - [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format
586
+ - [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
587
+ - [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy
588
+ - [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
589
+ - [`potm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled template
590
+ - [`potx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint template
591
+ - [`ppsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 macro-enabled slide show
592
+ - [`ppsx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 slide show
593
+ - [`pptm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled document
594
+ - [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft PowerPoint document
595
+ - [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
596
+ - [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
597
+ - [`pst`](https://en.wikipedia.org/wiki/Personal_Storage_Table) - Personal Storage Table file
598
+ - [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data
599
+ - [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file
600
+ - [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file
601
+ - [`reg`](https://en.wikipedia.org/wiki/Windows_Registry) - Windows registry (entries) file format
602
+ - [`rm`](https://en.wikipedia.org/wiki/RealMedia) - RealMedia
603
+ - [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file
604
+ - [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format
605
+ - [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file
606
+ - [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3
607
+ - [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format
608
+ - [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp
609
+ - [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
610
+ - [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file
611
+ - [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only)
612
+ - [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file
613
+ - [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tape archive or tarball
614
+ - [`tar.gz`](https://en.wikipedia.org/wiki/Gzip) - Gzipped tape archive (tarball)
615
+ - [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file
616
+ - [`ttc`](https://en.wikipedia.org/wiki/TrueType#TrueType_Collection) - TrueType Collection font
617
+ - [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font
618
+ - [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard
619
+ - [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File
620
+ - [`vsdx`](https://en.wikipedia.org/wiki/Microsoft_Visio) - Microsoft Visio File
621
+ - [`vtt`](https://en.wikipedia.org/wiki/WebVTT) - WebVTT File (for video captions)
622
+ - [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format
623
+ - [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file
624
+ - [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file
625
+ - [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format
626
+ - [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
627
+ - [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
628
+ - [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack
629
+ - [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility
630
+ - [`xlsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled document
631
+ - [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel document
632
+ - [`xltm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled template
633
+ - [`xltx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel template
634
+ - [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2
635
+ - [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language
636
+ - [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file
637
+ - [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file
638
+ - [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file
639
+ - [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file
640
+
641
+ *[Pull requests](.github/pull_request_template.md) are welcome for additional commonly used file types.*
642
+
643
+ The following file types will not be accepted:
644
+ - [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:
645
+ - `.doc` - Microsoft Word 97-2003 Document
646
+ - `.xls` - Microsoft Excel 97-2003 Document
647
+ - `.ppt` - Microsoft PowerPoint97-2003 Document
648
+ - `.msi` - Microsoft Windows Installer
649
+ - `.csv` - [Reason.](https://github.com/sindresorhus/file-type/issues/264#issuecomment-568439196)
650
+ - `.svg` - Supported by [third-party detector](#available-third-party-file-type-detectors).
651
+
652
+ #### tokenizer
653
+
654
+ Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer)
655
+
656
+ Usable as source of the examined file.
657
+
658
+ #### fileType
659
+
660
+ Type: `FileTypeResult`
661
+
662
+ An object having an `ext` (extension) and `mime` (mime type) property.
663
+
664
+ Detected by the standard detections or a previous custom detection. Undefined if no matching fileTypeResult could be found.
665
+
666
+ ## Related
667
+
668
+ - [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module
669
+ - [image-dimensions](https://github.com/sindresorhus/image-dimensions) - Get the dimensions of an image
670
+
671
+ ## Maintainers
672
+
673
+ - [Sindre Sorhus](https://github.com/sindresorhus)
674
+ - [Borewit](https://github.com/Borewit)