{"id":13396776,"url":"https://github.com/sindresorhus/file-type","last_synced_at":"2026-04-01T23:47:42.075Z","repository":{"id":16355300,"uuid":"19105307","full_name":"sindresorhus/file-type","owner":"sindresorhus","description":"Detect the file type of a file, stream, or data","archived":false,"fork":false,"pushed_at":"2026-03-26T17:34:07.000Z","size":92499,"stargazers_count":4255,"open_issues_count":0,"forks_count":395,"subscribers_count":29,"default_branch":"main","last_synced_at":"2026-03-31T06:04:03.417Z","etag":null,"topics":["buffer","detect","file","file-types","javascript","magic","magic-numbers","nodejs","uint8array"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-04-24T10:58:09.000Z","updated_at":"2026-03-29T23:19:14.000Z","dependencies_parsed_at":"2023-01-16T20:02:19.572Z","dependency_job_id":"5aa83cfd-8f1e-493d-8d39-1c26a14ede46","html_url":"https://github.com/sindresorhus/file-type","commit_stats":{"total_commits":526,"total_committers":117,"mean_commits":4.495726495726496,"dds":0.5342205323193916,"last_synced_commit":"a30977c8d528498ada2438651a9f601e3aedd7e6"},"previous_names":[],"tags_count":170,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/file-type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffile-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffile-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffile-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffile-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/file-type/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ffile-type/sbom","scorecard":{"id":787125,"data":{"date":"2025-08-11","repo":{"name":"github.com/sindresorhus/file-type","commit":"1511507734b1bf39f8b8b5f293f6c86148991b5e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Code-Review","score":7,"reason":"Found 23/30 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: .github/security.md:1","Info: Found linked content: .github/security.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/security.md:1","Info: Found text in security policy: .github/security.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"16 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":1,"reason":"binaries present in source code","details":["Warn: binary detected: fixture/fixture.class:1","Warn: binary detected: fixture/fixture.crx:1","Warn: binary detected: fixture/fixture.deb:1","Warn: binary detected: fixture/fixture.elf:1","Warn: binary detected: fixture/fixture.exe:1","Warn: binary detected: fixture/fixture.jar:1","Warn: binary detected: fixture/fixture.macho:1","Warn: binary detected: fixture/fixture.rpm:1","Warn: binary detected: fixture/fixture.wasm:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/file-type/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/file-type/main.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:22","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T06:22:40.684Z","repository_id":16355300,"created_at":"2025-08-23T06:22:40.684Z","updated_at":"2025-08-23T06:22:40.684Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buffer","detect","file","file-types","javascript","magic","magic-numbers","nodejs","uint8array"],"created_at":"2024-07-30T18:01:02.809Z","updated_at":"2026-04-01T23:47:42.065Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"\u003ch1 align=\"center\" title=\"file-type\"\u003e\n\t\u003cimg src=\"media/logo.jpg\" alt=\"file-type logo\"\u003e\n\u003c/h1\u003e\n\n\u003e Detect the file type of a file, stream, or data\n\nThe file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.\n\nThis package is for detecting binary-based file formats, not text-based formats like `.txt`, `.csv`, `.svg`, etc.\n\nWe accept contributions for commonly used modern file formats, not historical or obscure ones. Open an issue first for discussion.\n\n## Install\n\n```sh\nnpm install file-type\n```\n\n**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).**\n\nIf you use it with Webpack, you need the latest Webpack version and ensure you configure it correctly for ESM.\n\nFile type detection is based on binary signatures (magic numbers) and should be treated as a best-effort hint, not a guarantee.\n\n## Usage\n\n### Node.js\n\nDetermine file type from a file:\n\n```js\nimport {fileTypeFromFile} from 'file-type';\n\nconsole.log(await fileTypeFromFile('Unicorn.png'));\n//=\u003e {ext: 'png', mime: 'image/png'}\n```\n\nDetermine file type from a Uint8Array/ArrayBuffer, which may be a portion of the beginning of a file:\n\n```js\nimport {fileTypeFromBuffer} from 'file-type';\nimport {readChunk} from 'read-chunk';\n\nconst buffer = await readChunk('Unicorn.png', {length: 4100});\n\nconsole.log(await fileTypeFromBuffer(buffer));\n//=\u003e {ext: 'png', mime: 'image/png'}\n```\n\nDetermine file type from a stream:\n\n```js\nimport fs from 'node:fs';\nimport {fileTypeFromStream} from 'file-type';\n\nconst stream = fs.createReadStream('Unicorn.mp4');\n\nconsole.log(await fileTypeFromStream(stream));\n//=\u003e {ext: 'mp4', mime: 'video/mp4'}\n```\n\nThe stream method can also be used to read from a remote location:\n\n```js\nimport got from 'got';\nimport {fileTypeFromStream} from 'file-type';\n\nconst url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';\n\nconst stream = got.stream(url);\n\nconsole.log(await fileTypeFromStream(stream));\n//=\u003e {ext: 'jpg', mime: 'image/jpeg'}\n```\n\nAnother stream example:\n\n```js\nimport stream from 'node:stream';\nimport fs from 'node:fs';\nimport crypto from 'node:crypto';\nimport {fileTypeStream} from 'file-type';\n\nconst read = fs.createReadStream('encrypted.enc');\nconst decipher = crypto.createDecipheriv(alg, key, iv);\n\nconst streamWithFileType = await fileTypeStream(stream.pipeline(read, decipher));\n\nconsole.log(streamWithFileType.fileType);\n//=\u003e {ext: 'mov', mime: 'video/quicktime'}\n\nconst write = fs.createWriteStream(`decrypted.${streamWithFileType.fileType.ext}`);\nstreamWithFileType.pipe(write);\n```\n\n### Browser\n\n```js\nimport {fileTypeFromStream} from 'file-type';\n\nconst url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';\n\nconst response = await fetch(url);\nconst fileType = await fileTypeFromStream(response.body);\n\nconsole.log(fileType);\n//=\u003e {ext: 'jpg', mime: 'image/jpeg'}\n```\n\n## API\n\n### fileTypeFromBuffer(buffer, options)\n\nDetect the file type of a `Uint8Array`, or `ArrayBuffer`.\n\nThe file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.\n\nIf file access is available, it is recommended to use `fileTypeFromFile()` instead.\n\nReturns a `Promise` for an object with the detected file type:\n\n- `ext` - One of the [supported file types](#supported-file-types)\n- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)\n\nOr `undefined` when there is no match.\n\n#### buffer\n\nType: `Uint8Array | ArrayBuffer`\n\nA buffer representing file data. It works best if the buffer contains the entire file. It may work with a smaller portion as well.\n\n### fileTypeFromFile(filePath, options)\n\nDetect the file type of a file path.\n\nThis is for Node.js only.\n\nTo read from a [`File`](https://developer.mozilla.org/docs/Web/API/File), see [`fileTypeFromBlob()`](#filetypefromblobblob-options).\n\nThe file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.\n\nReturns a `Promise` for an object with the detected file type:\n\n- `ext` - One of the [supported file types](#supported-file-types)\n- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)\n\nOr `undefined` when there is no match.\n\n#### filePath\n\nType: `string`\n\nThe file path to parse.\n\n### fileTypeFromStream(stream)\n\nDetect the file type of a [web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).\n\nIf the engine is Node.js, this may also be a [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).\n\nDirect 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)).\n\nThe file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer.\n\nReturns a `Promise` for an object with the detected file type:\n\n- `ext` - One of the [supported file types](#supported-file-types)\n- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)\n\nOr `undefined` when there is no match.\n\n#### stream\n\nType: [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)\n\nA readable stream representing file data.\n\n### fileTypeFromBlob(blob, options)\n\nDetect the file type of a [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob),\n\n\u003e [!TIP]\n\u003e A [`File` object](https://developer.mozilla.org/docs/Web/API/File) is a `Blob` and can be passed in here.\n\nIt will **stream** the underlying Blob.\n\nThe file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the blob.\n\nReturns a `Promise` for an object with the detected file type:\n\n- `ext` - One of the [supported file types](#supported-file-types)\n- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)\n\nOr `undefined` when there is no match.\n\n```js\nimport {fileTypeFromBlob} from 'file-type';\n\nconst blob = new Blob(['\u003c?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?\u003e'], {\n\ttype: 'text/plain',\n\tendings: 'native'\n});\n\nconsole.log(await fileTypeFromBlob(blob));\n//=\u003e {ext: 'txt', mime: 'text/plain'}\n```\n\n#### blob\n\nType: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n\n### fileTypeFromTokenizer(tokenizer, options)\n\nDetect the file type from an `ITokenizer` source.\n\nThis method is used internally, but can also be used for a special \"tokenizer\" reader.\n\nA tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used.\n\nReturns a `Promise` for an object with the detected file type:\n\n- `ext` - One of the [supported file types](#supported-file-types)\n- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)\n\nOr `undefined` when there is no match.\n\nAn 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.\n\n```js\nimport {makeTokenizer} from '@tokenizer/http';\nimport {fileTypeFromTokenizer} from 'file-type';\n\nconst 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';\n\nconst httpTokenizer = await makeTokenizer(audioTrackUrl);\nconst fileType = await fileTypeFromTokenizer(httpTokenizer);\n\nconsole.log(fileType);\n//=\u003e {ext: 'mp3', mime: 'audio/mpeg'}\n```\n\nOr 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):\n\n```js\nimport {S3Client} from '@aws-sdk/client-s3';\nimport {makeChunkedTokenizerFromS3} from '@tokenizer/s3';\nimport {fileTypeFromTokenizer} from 'file-type';\n\n// Initialize the S3 client\n// Initialize S3 client\nconst s3 = new S3Client();\n\n// Initialize the S3 tokenizer.\nconst s3Tokenizer = await makeChunkedTokenizerFromS3(s3, {\n\tBucket: 'affectlab',\n\tKey: '1min_35sec.mp4'\n});\n\n// Figure out what kind of file it is.\nconst fileType = await fileTypeFromTokenizer(s3Tokenizer);\nconsole.log(fileType);\n```\n\nNote 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).\n\n#### tokenizer\n\nType: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer)\n\nA file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer).\n\n### fileTypeStream(webStream, options?)\n\nReturns 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()`.\n\nThis method can be handy to put in between a stream, but it comes with a price.\nInternally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample, to determine the file type.\nThe sample size impacts the file detection resolution.\nA smaller sample size will result in lower probability of the best file type detection.\n\n**Note:** When using Node.js, a `stream.Readable` may be provided as well.\n\n#### readableStream\n\nType: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)\n\n#### options\n\nType: `object`\n\nSupports the following options in addition to the [general options](#options):\n\n##### sampleSize\n\nType: `number`\\\nDefault: `4100`\n\nThe sample size in bytes.\n\n#### Example\n\n```js\nimport got from 'got';\nimport {fileTypeStream} from 'file-type';\n\nconst url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg';\n\nconst stream1 = got.stream(url);\nconst stream2 = await fileTypeStream(stream1, {sampleSize: 1024});\n\nif (stream2.fileType?.mime === 'image/jpeg') {\n\t// stream2 can be used to stream the JPEG image (from the very beginning of the stream)\n}\n```\n\n#### readableStream\n\nType: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)\n\nThe input stream.\n\n### supportedExtensions\n\nReturns a `Set\u003cstring\u003e` of supported file extensions.\n\n### supportedMimeTypes\n\nReturns a `Set\u003cstring\u003e` of supported MIME types.\n\n### Options\n\n#### customDetectors\n\nArray of custom file type detectors to run before default detectors.\n\nFor example:\n\n```js\nimport {fileTypeFromFile} from 'file-type';\nimport {detectXml} from '@file-type/xml';\n\nconst fileType = await fileTypeFromFile('sample.kml', {customDetectors: [detectXml]});\nconsole.log(fileType);\n```\n\n#### mpegOffsetTolerance\n\nDefault: `0`\n\nSpecifies the byte tolerance for locating the first MPEG audio frame (e.g. `.mp1`, `.mp2`, `.mp3`, `.aac`).\n\nAllows 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.\n\nA tolerance of 10 bytes covers most cases.\n\n## Custom detectors\n\nCustom file type detectors are plugins designed to extend the default detection capabilities.\nThey allow support for uncommon file types, non-binary formats, or customized detection behavior.\n\nDetectors can be added via the constructor options or by modifying `FileTypeParser#detectors` directly.\nDetectors provided through the constructor are executed before the default ones.\n\nDetectors can be added via the constructor options or by directly modifying `FileTypeParser#detectors`.\n\n### Example adding a detector\n\nFor example:\n\n```js\nimport {FileTypeParser} from 'file-type';\nimport {detectXml} from '@file-type/xml';\n\nconst parser = new FileTypeParser({customDetectors: [detectXml]});\nconst fileType = await parser.fromFile('sample.kml');\nconsole.log(fileType);\n```\n\n### Available third-party file-type detectors\n\n- [@file-type/av](https://github.com/Borewit/file-type-av): Improves detection of audio and video file formats, with accurate differentiation between the two\n- [@file-type/cfbf](https://github.com/Borewit/file-type-cfbf): Detects Compound File Binary Format (CFBF) based formats, such as Office 97–2003 documents and `.msi`.\n- [@file-type/pdf](https://github.com/Borewit/file-type-pdf): Detects PDF based file types, such as Adobe Illustrator\n- [@file-type/xml](https://github.com/Borewit/file-type-xml): Detects common XML file types, such as GLM, KML, MusicXML, RSS, SVG, and XHTML\n\n### Detector execution flow\n\nIf a detector returns `undefined`, the following rules apply:\n\n1. **No Tokenizer Interaction**: If the detector does not modify the tokenizer's position, the next detector in the sequence is executed.\n2. **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.\n\n### Writing your own custom detector\n\nBelow is an example of a custom detector array. This can be passed to the `FileTypeParser` via the `fileTypeOptions` argument.\n\n```js\nimport {FileTypeParser} from 'file-type';\n\nconst unicornDetector = {\n\tid: 'unicorn', // May be used to recognize the detector in the detector list\n  \tasync detect(tokenizer) {\n\t\tconst unicornHeader = [85, 78, 73, 67, 79, 82, 78]; // \"UNICORN\" in ASCII decimal\n\n\t\tconst buffer = new Uint8Array(unicornHeader.length);\n\t\tawait tokenizer.peekBuffer(buffer, {length: unicornHeader.length, mayBeLess: true});\n\t\tif (unicornHeader.every((value, index) =\u003e value === buffer[index])) {\n\t\t\treturn {ext: 'unicorn', mime: 'application/unicorn'};\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nconst buffer = new Uint8Array([85, 78, 73, 67, 79, 82, 78]);\nconst parser = new FileTypeParser({customDetectors: [unicornDetector]});\nconst fileType = await parser.fromBuffer(buffer);\nconsole.log(fileType); // {ext: 'unicorn', mime: 'application/unicorn'}\n```\n\n```ts\n/**\n@param tokenizer - The [tokenizer](https://github.com/Borewit/strtok3#tokenizer) used to read file content.\n@param fileType - The file type detected by standard or previous custom detectors, or `undefined` if no match is found.\n@returns The detected file type, or `undefined` if no match is found.\n*/\nexport type Detector = (tokenizer: ITokenizer, fileType?: FileTypeResult) =\u003e Promise\u003cFileTypeResult | undefined\u003e;\n```\n\n## Abort signal\n\nSome async operations can be aborted by passing an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to the `FileTypeParser` constructor.\n\n```js\nimport {FileTypeParser} from 'file-type';\n\nconst abortController = new AbortController()\n\nconst parser = new FileTypeParser({abortSignal: abortController.signal});\n\nconst promise = parser.fromStream(blob.stream());\n\nabortController.abort(); // Abort file-type reading from the Blob stream.\n```\n\n## Supported file types\n\n- [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services\n- [`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\n- [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format\n- [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive\n- [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File\n- [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding\n- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File\n- [`ace`](https://en.wikipedia.org/wiki/ACE_(compressed_file_format)) - ACE archive\n- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file\n- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file\n- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec\n- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio\n- [`apk`](https://en.wikipedia.org/wiki/Apk_(file_format)) - Android package format\n- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics\n- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file\n- [`arj`](https://en.wikipedia.org/wiki/ARJ) - Archive file\n- [`arrow`](https://arrow.apache.org) - Columnar format for tables of data\n- [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file\n- [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications\n- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format\n- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file\n- [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format\n- [`avro`](https://en.wikipedia.org/wiki/Apache_Avro#Avro_Object_Container_File) - Object container file developed by Apache Avro\n- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project\n- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file\n- [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file\n- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file\n- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file\n- [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compound File Binary Format\n- [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help\n- [`class`](https://en.wikipedia.org/wiki/Java_class_file) - Java class file\n- [`cpio`](https://en.wikipedia.org/wiki/Cpio) - Cpio archive\n- [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2)\n- [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3)\n- [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension\n- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file\n- [`dat`](https://en.wikipedia.org/wiki/Windows_Registry) - Windows registry hive file\n- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File\n- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package\n- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image\n- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file\n- [`docm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled document\n- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document\n- [`dotm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled template\n- [`dotx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word template\n- [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression\n- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)\n- [`dwg`](https://en.wikipedia.org/wiki/.dwg) - Autodesk CAD file\n- [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format\n- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font\n- [`eps`](https://en.wikipedia.org/wiki/Encapsulated_PostScript) - Encapsulated PostScript\n- [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file\n- [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file\n- [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player\n- [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player\n- [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player\n- [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player\n- [`fbx`](https://en.wikipedia.org/wiki/FBX) - Filmbox is a proprietary file format used to provide interoperability between digital content creation apps.\n- [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec\n- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format\n- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video\n- [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format\n- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format\n- [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file\n- [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format\n- [`icc`](https://en.wikipedia.org/wiki/ICC_profile) - ICC Profile\n- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image\n- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file\n- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar\n- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document\n- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker\n- [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000\n- [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive\n- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images\n- [`jmp`](https://en.wikipedia.org/wiki/JMP_(statistical_software)) - JMP data file format by SAS Institute\n- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000\n- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image\n- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000\n- [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000\n- [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format\n- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range\n- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures\n- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut\n- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Archive file\n- [`lz4`](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) - Compressed archive created by one of a variety of LZ4 compression utilities\n- [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive\n- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files\n- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks\n- [`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\n- [`m4v`](https://en.wikipedia.org/wiki/M4V) - Video container format developed by Apple, which is very similar to the MP4 format\n- [`macho`](https://en.wikipedia.org/wiki/Mach-O) - Mach-O binary format\n- [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file\n- [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information\n- [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000\n- [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file\n- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket\n- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file\n- [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I\n- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II\n- [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file\n- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file\n- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 \u0026 SV8)\n- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file\n- [`mts`](https://en.wikipedia.org/wiki/.m2ts) - MPEG-2 Transport Stream, both raw and Blu-ray Disc Audio-Video (BDAV) versions\n- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format\n- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file\n- [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM\n- [`odg`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for drawing\n- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations\n- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets\n- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing\n- [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file\n- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file\n- [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font\n- [`otg`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for drawing\n- [`otp`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for presentations\n- [`ots`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for spreadsheets\n- [`ott`](https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Templates) - OpenDocument template for word processing\n- [`parquet`](https://en.wikipedia.org/wiki/Apache_Parquet) - Apache Parquet\n- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format\n- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format\n- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy\n- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics\n- [`potm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled template\n- [`potx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint template\n- [`ppsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 macro-enabled slide show\n- [`ppsx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 slide show\n- [`pptm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled document\n- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft PowerPoint document\n- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript\n- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document\n- [`pst`](https://en.wikipedia.org/wiki/Personal_Storage_Table) - Personal Storage Table file\n- [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data\n- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file\n- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file\n- [`reg`](https://en.wikipedia.org/wiki/Windows_Registry) - Windows registry (entries) file format\n- [`rm`](https://en.wikipedia.org/wiki/RealMedia) - RealMedia\n- [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file\n- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format\n- [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file\n- [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3\n- [`sav`](https://en.wikipedia.org/wiki/SPSS) - SPSS Statistical Data File\n- [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format\n- [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp\n- [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file\n- [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file\n- [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only)\n- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file\n- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tape archive or tarball\n- [`tar.gz`](https://en.wikipedia.org/wiki/Gzip) - Gzipped tape archive (tarball)\n- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file\n- [`ttc`](https://en.wikipedia.org/wiki/TrueType#TrueType_Collection) - TrueType Collection font\n- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font\n- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard\n- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File\n- [`vsdx`](https://en.wikipedia.org/wiki/Microsoft_Visio) - Microsoft Visio File\n- [`vtt`](https://en.wikipedia.org/wiki/WebVTT) - WebVTT File (for video captions)\n- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format\n- [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file\n- [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file\n- [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format\n- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format\n- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format\n- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack\n- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility\n- [`xlsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled document\n- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel document\n- [`xltm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled template\n- [`xltx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel template\n- [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2\n- [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language\n- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file\n- [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file\n- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file\n- [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file\n\n*[Pull requests](.github/pull_request_template.md) are welcome for additional commonly used file types.*\n\nThe following file types will not be accepted, but most of them are supported by [third-party detector](#available-third-party-file-type-detectors)\n- [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)\n\t- `.doc` - Microsoft Word 97-2003 Document\n\t- `.xls` - Microsoft Excel 97-2003 Document\n\t- `.ppt` - Microsoft PowerPoint97-2003 Document\n\t- `.msi` - Microsoft Windows Installer\n- `.csv` - [Reason.](https://github.com/sindresorhus/file-type/issues/264#issuecomment-568439196)\n- `.svg`\n\n#### tokenizer\n\nType: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer)\n\nUsable as source of the examined file.\n\n#### fileType\n\nType: `FileTypeResult`\n\nAn object having an `ext` (extension) and `mime` (mime type) property.\n\nDetected by the standard detections or a previous custom detection. Undefined if no matching fileTypeResult could be found.\n\n## Related\n\n- [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module\n- [image-dimensions](https://github.com/sindresorhus/image-dimensions) - Get the dimensions of an image\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Borewit](https://github.com/Borewit)\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["文件","JavaScript","Packages","包","Miscellaneous","js库(Browser/Nodejs)","Node","Number","file format (文件格式)"],"sub_categories":["Miscellaneous","其他","杂项"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ffile-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Ffile-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ffile-type/lists"}