{"author":{"name":"Robert Kieffer","email":"robert@broofa.com","url":"http://github.com/broofa"},"type":"module","engines":{"node":">=16"},"main":"./dist/src/index.js","exports":{".":"./dist/src/index.js","./lite":"./dist/src/index_lite.js","./types/standard.js":"./dist/types/standard.js","./types/other.js":"./dist/types/other.js","./package.json":"./package.json"},"bin":{"mime":"bin/cli.js"},"contributors":[],"description":"A comprehensive library for mime-type mapping","license":"MIT","devDependencies":{"@types/mime-db":"1.*","@types/mime-types":"2.1.4","@types/node":"22.10.2","@typescript-eslint/eslint-plugin":"8.18.1","@typescript-eslint/parser":"8.18.1","chalk":"5.3.0","mime-score":"2.0.4","mime-types":"2.1.35","prettier":"3.4.2","release-please":"16.15.0","runmd":"1.3.9","typescript":"5.7.2"},"scripts":{"build":"rm -fr dist && tsc","build:types":"node dist/scripts/build.js","build:watch":"npm run build -- --watch","lint":"prettier -c .","lint:fix":"prettier -w .","prepack":"npm run build","pretest":"npm run build","prepublishOnly":"npm test","test":"node --test && ./test/exports_test.sh","test:watch":"clear && node --enable-source-maps --test --watch test"},"keywords":["extension","file","mime","mime-db","mimetypes","util"],"name":"mime","repository":{"url":"git+https://github.com/broofa/mime.git","type":"git"},"version":"4.0.6","funding":["https://github.com/sponsors/broofa"],"packageManager":"npm@11.0.0","_id":"mime@4.0.6","gitHead":"a9263fe0419378a6b1429a2b31892d203d1f2507","types":"./dist/src/index.d.ts","bugs":{"url":"https://github.com/broofa/mime/issues"},"homepage":"https://github.com/broofa/mime#readme","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-4rGt7rvQHBbaSOF9POGkk1ocRP16Md1x36Xma8sz8h8/vfCUI2OtEIeCqe4Ofes853x4xDoPiFLIT47J5fI/7A==","shasum":"ca83bec0bcf2a02353d0e02da99be05603d04839","tarball":"http://registry-npm.ywwl.com/mime/download/mime-4.0.6.tgz","fileCount":22,"unpackedSize":105887,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcDA+8drml0tMFCNxDG4+hw73Vjn31lRszlbQqXOsWawIhAMNlI9q74nGsMnO7ZaSgESluuLzxje1KuuvkX1yIOtrW"}],"size":28176,"noattachment":false,"key":"/mime/-/mime-4.0.6.tgz"},"_npmUser":{"name":"broofa","email":"robert@broofa.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mime_4.0.6_1734471408940_0.735007444687436"},"_hasShrinkwrap":false,"readme":"<!--\n  -- This file is auto-generated from src/README_js.md. Changes should be made there.\n  -->\n# Mime\n\n[![NPM downloads](https://img.shields.io/npm/dm/mime)](https://www.npmjs.com/package/mime)\n[![Mime CI](https://github.com/broofa/mime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/broofa/mime/actions/workflows/ci.yml?query=branch%3Amain)\n\nAn API for MIME type information.\n\n- All `mime-db` types\n- Compact and dependency-free [![mime's badge](https://deno.bundlejs.com/?q=mime&badge)](https://bundlejs.com/?q=mime)\n- Full TS support\n\n\n> [!Note]\n> `mime@4` is now `latest`.  If you're upgrading from `mime@3`, note the following:\n> * `mime@4` is API-compatible with `mime@3`, with ~~one~~ two exceptions:\n>   * Direct imports of `mime` properties [no longer supported](https://github.com/broofa/mime/issues/295)\n>   * `mime.define()` cannot be called on the default `mime` object\n> * ESM module support is required.   [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).\n> * Requires an [ES2020](https://caniuse.com/?search=es2020) or newer runtime\n> * Built-in Typescript types (`@types/mime` no longer needed)\n\n## Installation\n\n```bash\nnpm install mime\n```\n\n## Quick Start\n\nFor the full version (800+ MIME types, 1,000+ extensions):\n\n```javascript\nimport mime from 'mime';\n\nmime.getType('txt');                    // ⇨ 'text/plain'\nmime.getExtension('text/plain');        // ⇨ 'txt'\n```\n\n### Lite Version [![mime/lite's badge](https://deno.bundlejs.com/?q=mime/lite&badge)](https://bundlejs.com/?q=mime/lite)\n\n`mime/lite` is a drop-in `mime` replacement, stripped of unofficial (\"`prs.*`\", \"`x-*`\", \"`vnd.*`\") types:\n\n```javascript\nimport mime from 'mime/lite';\n```\n\n## API\n\n### `mime.getType(pathOrExtension)`\n\nGet mime type for the given file path or extension. E.g.\n\n```javascript\nmime.getType('js');             // ⇨ 'text/javascript'\nmime.getType('json');           // ⇨ 'application/json'\n\nmime.getType('txt');            // ⇨ 'text/plain'\nmime.getType('dir/text.txt');   // ⇨ 'text/plain'\nmime.getType('dir\\\\text.txt');  // ⇨ 'text/plain'\nmime.getType('.text.txt');      // ⇨ 'text/plain'\nmime.getType('.txt');           // ⇨ 'text/plain'\n```\n\n`null` is returned in cases where an extension is not detected or recognized\n\n```javascript\nmime.getType('foo/txt');        // ⇨ null\nmime.getType('bogus_type');     // ⇨ null\n```\n\n### `mime.getExtension(type)`\n\nGet file extension for the given mime type. Charset options (often included in Content-Type headers) are ignored.\n\n```javascript\nmime.getExtension('text/plain');               // ⇨ 'txt'\nmime.getExtension('application/json');         // ⇨ 'json'\nmime.getExtension('text/html; charset=utf8');  // ⇨ 'html'\n```\n\n### `mime.getAllExtensions(type)`\n\n> [!Note]\n> New in `mime@4`\n\nGet all file extensions for the given mime type.\n\n```javascript --run default\nmime.getAllExtensions('image/jpeg'); // ⇨ Set(3) { 'jpeg', 'jpg', 'jpe' }\n```\n\n## Custom `Mime` instances\n\nThe default `mime` objects are immutable.  Custom, mutable versions can be created as follows...\n### new Mime(type map [, type map, ...])\n\nCreate a new, custom mime instance.  For example, to create a mutable version of the default `mime` instance:\n\n```javascript\nimport { Mime } from 'mime/lite';\n\nimport standardTypes from 'mime/types/standard.js';\nimport otherTypes from 'mime/types/other.js';\n\nconst mime = new Mime(standardTypes, otherTypes);\n```\n\nEach argument is passed to the `define()` method, below. For example `new Mime(standardTypes, otherTypes)` is synonomous with `new Mime().define(standardTypes).define(otherTypes)`\n\n### `mime.define(type map [, force = false])`\n\n> [!Note]\n> Only available on custom `Mime` instances\n\nDefine MIME type -> extensions.\n\nAttempting to map a type to an already-defined extension will `throw` unless the `force` argument is set to `true`.\n\n```javascript\nmime.define({'text/x-abc': ['abc', 'abcd']});\n\nmime.getType('abcd');            // ⇨ 'text/x-abc'\nmime.getExtension('text/x-abc')  // ⇨ 'abc'\n```\n\n## Command Line\n\n### Extension -> type\n\n```bash\n$ mime scripts/jquery.js\ntext/javascript\n```\n\n### Type -> extension\n\n```bash\n$ mime -r image/jpeg\njpeg\n```\n","publish_time":1734471409144,"maintainers":[{"name":"broofa","email":"robert@broofa.com"}],"_cnpm_publish_time":1734471409144,"dist-tags":{"latest":"4.1.2"}}