{"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.43.6","@types/mime-types":"3.0.1","@types/node":"24.3.1","@typescript-eslint/eslint-plugin":"8.43.0","@typescript-eslint/parser":"8.43.0","chalk":"5.6.2","mime-score":"2.0.4","mime-types":"3.0.1","prettier":"3.6.2","release-please":"17.1.2","runmd":"1.4.1","typescript":"5.9.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.1.0","funding":["https://github.com/sponsors/broofa"],"packageManager":"npm@11.6.0","_id":"mime@4.1.0","gitHead":"a3c97a312e40f6ce7157742f4b1f5fd00702422a","types":"./dist/src/index.d.ts","bugs":{"url":"https://github.com/broofa/mime/issues"},"homepage":"https://github.com/broofa/mime#readme","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-X5ju04+cAzsojXKes0B/S4tcYtFAJ6tTMuSPBEn9CPGlrWr8Fiw7qYeLT0XyH80HSoAoqWCaz+MWKh22P7G1cw==","shasum":"ec55df7aa21832a36d44f0bbee5c04639b27802f","tarball":"http://registry-npm.ywwl.com/mime/download/mime-4.1.0.tgz","fileCount":22,"unpackedSize":161244,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICz5Bx/wBaFy30KRoHCpXuG/nF/nJQv2PGXaRgO4hXXrAiBvlbBP/Kw3x7Q/Za+/tLp+msMOHMP7lUSNgEwemcOmpw=="}],"size":38668,"noattachment":false,"key":"/mime/-/mime-4.1.0.tgz"},"_npmUser":{"name":"broofa","email":"robert@broofa.com"},"directories":{},"maintainers":[{"name":"broofa","email":"robert@broofa.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mime_4.1.0_1757699581130_0.017626337612350662"},"_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":1757699581376,"_cnpm_publish_time":1757699581376,"dist-tags":{"latest":"4.1.2"}}