{"_id":"@cjser/file-type__v19_6_0","name":"@cjser/file-type__v19_6_0","dist-tags":{"latest":"19.6.0-cjser.2"},"versions":{"19.6.0-cjser.2":{"name":"@cjser/file-type__v19_6_0","version":"19.6.0-cjser.2","description":"Detect the file type of a file, stream, or data","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sindresorhus/file-type?sponsor=1","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{".":{"require":"./dist-cjser/index.cjs","node":{"types":"./index.d.ts","import":"./index.js"},"default":{"types":"./core.d.ts","import":"./core.js"}},"./core":{"types":"./core.d.ts","require":"./dist-cjser/core.cjs","import":"./core.js"}},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["mime","file","type","magic","archive","image","img","pic","picture","flash","photo","video","detect","check","is","exif","elf","macho","exe","binary","buffer","uint8array","jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","ogg","opus","flac","wav","amr","pdf","epub","mobi","swf","rtf","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","wasm","webassembly","blend","bpg","docx","pptx","xlsx","3gp","j2c","jp2","jpm","jpx","mj2","aif","odt","ods","odp","xml","heic","ics","glb","pcap","dsf","lnk","alias","voc","ac3","3g2","m4b","m4p","m4v","f4a","f4b","f4p","f4v","mie","qcp","asf","ogv","ogm","oga","spx","ogx","ape","wv","cur","nes","crx","ktx","dcm","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk"],"dependencies":{"@cjser/get-stream":"9.0.1-cjser.2","@cjser/strtok3__v9_1_1":"9.1.1-cjser.2","@cjser/token-types":"6.1.2-cjser.2","@cjser/uint8array-extras":"1.5.0-cjser.2"},"devDependencies":{"@tokenizer/token":"^0.3.0","@types/node":"^20.10.7","ava":"^6.0.1","commonmark":"^0.30.0","noop-stream":"^1.0.0","tsd":"^0.30.3","xo":"^0.56.0"},"xo":{"envs":["node","browser"],"ignores":["fixture"],"rules":{"no-inner-declarations":"warn","no-await-in-loop":"warn","no-bitwise":"off","@typescript-eslint/no-unsafe-assignment":"off","unicorn/text-encoding-identifier-case":"off","unicorn/switch-case-braces":"off","unicorn/prefer-top-level-await":"off"}},"ava":{"serial":true},"types":"./index.d.ts","main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"19.6.0","cjserVersion":2,"original":{"name":"file-type","version":"19.6.0","exports":{".":{"node":{"types":"./index.d.ts","import":"./index.js"},"default":{"types":"./core.d.ts","import":"./core.js"}},"./core":{"types":"./core.d.ts","import":"./core.js"}},"repository":"sindresorhus/file-type","dependencies":{"get-stream":"^9.0.1","strtok3":"^9.0.1","token-types":"^6.0.0","uint8array-extras":"^1.3.0"},"files":["index.js","index.d.ts","core.js","core.d.ts","supported.js","util.js"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/file-type__v19_6_0@19.6.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-9C85f7C8pKHta7MjvwpKZ/BQg+B93fYi49FMw2FHJsgNIDzSuUeBCymei1ZK4MRNon1kHcPU9BNAhvuqUHDN9w==","shasum":"399e00021b04641793b94076a5e163add5115859","tarball":"https://registry.npmjs.org/@cjser/file-type__v19_6_0/-/file-type__v19_6_0-19.6.0-cjser.2.tgz","fileCount":11,"unpackedSize":198983,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCaDUI1neR+CAJj4XtClDSV34r3KwuaJJlrybi/PV7agAIgVeB294Q784g+lPs2hQ6XfXZot4w3uFhwhTx+bG8LUmc="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/file-type__v19_6_0_19.6.0-cjser.2_1778158050223_0.7141792566240623"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T12:47:30.128Z","19.6.0-cjser.2":"2026-05-07T12:47:30.403Z","modified":"2026-05-07T12:47:30.624Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Detect the file type of a file, stream, or data","keywords":["mime","file","type","magic","archive","image","img","pic","picture","flash","photo","video","detect","check","is","exif","elf","macho","exe","binary","buffer","uint8array","jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","ogg","opus","flac","wav","amr","pdf","epub","mobi","swf","rtf","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","wasm","webassembly","blend","bpg","docx","pptx","xlsx","3gp","j2c","jp2","jpm","jpx","mj2","aif","odt","ods","odp","xml","heic","ics","glb","pcap","dsf","lnk","alias","voc","ac3","3g2","m4b","m4p","m4v","f4a","f4b","f4p","f4v","mie","qcp","asf","ogv","ogm","oga","spx","ogx","ape","wv","cur","nes","crx","ktx","dcm","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"<h1 align=\"center\" title=\"file-type\">\n\t<img src=\"media/logo.jpg\" alt=\"file-type logo\">\n</h1>\n\n> 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).**\n\nIf you use it with Webpack, you need the latest Webpack version and ensure you configure it correctly for ESM.\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//=> {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//=> {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//=> {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//=> {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//=> {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//=> {ext: 'jpg', mime: 'image/jpeg'}\n```\n\n## API\n\n### fileTypeFromBuffer(buffer)\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)\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).\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)\n\nDetect the file type of a [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob),\n\n[!TIP]\n> 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, and required a [ReadableStreamBYOBReader](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader) which **require Node.js ≥ 20**.\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(['<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>'], {\n\ttype: 'text/plain',\n\tendings: 'native'\n});\n\nconsole.log(await fileTypeFromBlob(blob));\n//=> {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)\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//=> {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 S3 from 'aws-sdk/clients/s3';\nimport {makeTokenizer} from '@tokenizer/s3';\nimport {fileTypeFromTokenizer} from 'file-type';\n\n// Initialize the S3 client\nconst s3 = new S3();\n\n// Initialize the S3 tokenizer.\nconst s3Tokenizer = await makeTokenizer(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\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<string>` of supported file extensions.\n\n### supportedMimeTypes\n\nReturns a `Set<string>` of supported MIME types.\n\n## Custom detectors\n\nA custom detector is a function that allows specifying custom detection mechanisms.\n\nAn iterable of detectors can be provided via the `fileTypeOptions` argument for the `FileTypeParser` constructor.\nIn Node.js, you should use `NodeFileTypeParser`, which extends `FileTypeParser` and provides access to Node.js specific functions.\n\nThe detectors are called before the default detections in the provided order.\n\nCustom detectors can be used to add new `FileTypeResults` or to modify return behaviour of existing `FileTypeResult` detections.\n\nIf the detector returns `undefined`, there are 2 possible scenarios:\n\n1. The detector has not read from the tokenizer, it will be proceeded with the next available detector.\n2. The detector has read from the tokenizer (`tokenizer.position` has been increased).\n\tIn that case no further detectors will be executed and the final conclusion is that file-type returns undefined.\n\tNote that this an exceptional scenario, as the detector takes the opportunity from any other detector to determine the file type.\n\nExample detector array which can be extended and provided to each public method via the `fileTypeOptions` argument:\n\n```js\nimport {FileTypeParser} from 'file-type'; // or `NodeFileTypeParser` in Node.js\n\nconst customDetectors = [\n\tasync tokenizer => {\n\t\tconst unicornHeader = [85, 78, 73, 67, 79, 82, 78]; // 'UNICORN' as decimal string\n\n\t\tconst buffer = new Uint8Array(7);\n\t\tawait tokenizer.peekBuffer(buffer, {length: unicornHeader.length, mayBeLess: true});\n\n\t\tif (unicornHeader.every((value, index) => 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(new TextEncoder().encode('UNICORN'));\nconst parser = new FileTypeParser({customDetectors}); // `NodeFileTypeParser({customDetectors})` in Node.js\nconst fileType = await parser.fromBuffer(buffer);\nconsole.log(fileType);\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'; // or `NodeFileTypeParser` in Node.js\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- [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork\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- [`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- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document\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- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images\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- [`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 & 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- [`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- [`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- [`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- [`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- [`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) - Tarball archive file\n- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file\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- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel document\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:\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), too old and difficult to parse:\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` - Detecting it requires a full-blown parser. Check out [`is-svg`](https://github.com/sindresorhus/is-svg) for something that mostly works.\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\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/file-type\n","readmeFilename":"readme.md","_rev":"1-44dbd805663e4e39ad78b590c19cecd4"}