{"author":{"name":"Robert Kieffer","email":"robert@broofa.com","url":"http://github.com/broofa"},"engines":{"node":">=10.0.0"},"bin":{"mime":"cli.js"},"contributors":[],"description":"A comprehensive library for mime-type mapping","license":"MIT","dependencies":{},"devDependencies":{"benchmark":"*","chalk":"4.1.2","eslint":"8.1.0","mime-db":"1.50.0","mime-score":"1.2.0","mime-types":"2.1.33","mocha":"9.1.3","runmd":"*","standard-version":"9.3.2"},"scripts":{"prepare":"node src/build.js && runmd --output README.md src/README_js.md","release":"standard-version","benchmark":"node src/benchmark.js","md":"runmd --watch --output README.md src/README_js.md","test":"mocha src/test.js"},"keywords":["util","mime"],"name":"mime","repository":{"url":"git+https://github.com/broofa/mime.git","type":"git"},"version":"3.0.0","gitHead":"0e268c96b9d8f11bf6d39509d26980bdec9a42f9","bugs":{"url":"https://github.com/broofa/mime/issues"},"homepage":"https://github.com/broofa/mime#readme","_id":"mime@3.0.0","_nodeVersion":"14.17.6","_npmVersion":"6.14.15","_npmUser":{"name":"broofa","email":"robert@broofa.com"},"dist":{"shasum":"b374550dca3a0c18443b0c950a6a58f1931cf7a7","size":18690,"noattachment":false,"tarball":"https://registry.npmmirror.com/mime/-/mime-3.0.0.tgz","integrity":"sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A=="},"directories":{},"maintainers":[{"name":"broofa","email":"robert@broofa.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mime_3.0.0_1635900647619_0.0013969640828677132"},"_hasShrinkwrap":false,"publish_time":1635900648131,"_cnpm_publish_time":1635900648131,"_cnpmcore_publish_time":"2021-12-13T11:23:49.066Z","readme":"\n# Mime\n\nA comprehensive, compact MIME type module.\n\n[![Build Status](https://travis-ci.org/broofa/mime.svg?branch=master)](https://travis-ci.org/broofa/mime)\n\n## Install\n\n### NPM\n```\nnpm install mime\n```\n\n### Browser\n\nIt is recommended that you use a bundler such as\n[webpack](https://webpack.github.io/) or [browserify](http://browserify.org/) to\npackage your code. However, browser-ready versions are available via\nskypack.dev as follows:\n```\n// Full version\n\n```\n\n```\n// \"lite\" version\n\n```\n\n## Quick Start\n\nFor the full version (800+ MIME types, 1,000+ extensions):\n\n```javascript\nconst mime = require('mime');\n\nmime.getType('txt'); // ⇨ 'text/plain'\nmime.getExtension('text/plain'); // ⇨ 'txt'\n```\n\nSee [Mime API](#mime-api) below for API details.\n\n## Lite Version\n\nThe \"lite\" version of this module omits vendor-specific (`*/vnd.*`) and\nexperimental (`*/x-*`) types. It weighs in at ~2.5KB, compared to 8KB for the\nfull version. To load the lite version:\n\n```javascript\nconst mime = require('mime/lite');\n```\n\n## Mime .vs. mime-types .vs. mime-db modules\n\nFor those of you wondering about the difference between these [popular] NPM modules,\nhere's a brief rundown ...\n\n[`mime-db`](https://github.com/jshttp/mime-db) is \"the source of\ntruth\" for MIME type information. It is not an API. Rather, it is a canonical\ndataset of mime type definitions pulled from IANA, Apache, NGINX, and custom mappings\nsubmitted by the Node.js community.\n\n[`mime-types`](https://github.com/jshttp/mime-types) is a thin\nwrapper around mime-db that provides an API drop-in compatible(ish) with `mime @ < v1.3.6` API.\n\n`mime` is, as of v2, a self-contained module bundled with a pre-optimized version\nof the `mime-db` dataset. It provides a simplified API with the following characteristics:\n\n* Intelligently resolved type conflicts (See [mime-score](https://github.com/broofa/mime-score) for details)\n* Method naming consistent with industry best-practices\n* Compact footprint. E.g. The minified+compressed sizes of the various modules:\n\nModule | Size\n--- | ---\n`mime-db` | 18 KB\n`mime-types` | same as mime-db\n`mime` | 8 KB\n`mime/lite` | 2 KB\n\n## Mime API\n\nBoth `require('mime')` and `require('mime/lite')` return instances of the MIME\nclass, documented below.\n\nNote: Inputs to this API are case-insensitive. Outputs (returned values) will\nbe lowercase.\n\n### new Mime(typeMap, ... more maps)\n\nMost users of this module will not need to create Mime instances directly.\nHowever if you would like to create custom mappings, you may do so as follows\n...\n\n```javascript\n// Require Mime class\nconst Mime = require('mime/Mime');\n\n// Define mime type -> extensions map\nconst typeMap = {\n 'text/abc': ['abc', 'alpha', 'bet'],\n 'text/def': ['leppard']\n};\n\n// Create and use Mime instance\nconst myMime = new Mime(typeMap);\nmyMime.getType('abc'); // ⇨ 'text/abc'\nmyMime.getExtension('text/def'); // ⇨ 'leppard'\n```\n\nIf more than one map argument is provided, each map is `define()`ed (see below), in order.\n\n### mime.getType(pathOrExtension)\n\nGet mime type for the given path or extension. E.g.\n\n```javascript\nmime.getType('js'); // ⇨ 'application/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)\nGet extension for the given mime type. Charset options (often included in\nContent-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.define(typeMap[, force = false])\n\nDefine [more] type mappings.\n\n`typeMap` is a map of type -> extensions, as documented in `new Mime`, above.\n\nBy default this method will throw an error if you try to map a type to an\nextension that is already assigned to another type. Passing `true` for the\n`force` argument will suppress this behavior (overriding any previous mapping).\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 mime [path_or_extension]\n\nE.g.\n\n > mime scripts/jquery.js\n application/javascript\n\n----\nMarkdown generated from [src/README_js.md](src/README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd)"}