{"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"keywords":["mime","mime-db","types"],"dist-tags":{"latest":"3.0.4"},"description":"the custom more powerful mime-type utility can work with mime-db.","readme":"# mime-type\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nThe custom more powerful mime-type utility can work with [mime-db](https://github.com/jshttp/mime-db).\n\nfork from [mime-types](https://github.com/jshttp/mime-types), these features added:\n\n- you can load mime-types via [mime-db](https://github.com/jshttp/mime-db) `mime = new Mime(require('mime-db'))`\n  - or use `mime = require('mime-type/with-db')` directly, but first\n  - you need `npm install mime-db`\n- `mime = new Mime()` business, so you could do `lookup = mime.lookup.bind(mime)`.\n- you can add the mime-type via `.define(type, mime)` functionality\n- you can add many mime-type via `.load(mimes)` functionality\n- you can search the mime-type via `.glob(pattern)` functionality\n- you can remove a mime-type via `.delete(type)` functionality\n- you can clear mime-types via `.clear(filter)` functionality\n- `.exist(type)` functionality to check whether a mime-type is exist.\n- `.extensions` will be deprecated, use `mime[type].extensions` instead.\n- All functions return `undefined` if input is invalid or not found.\n\nOtherwise, the API is compatible.\n\n## Install\n\n```sh\n$ npm install mime-type\n```\n\n## API\n\n```js\n//create an empty mime-type:\nvar mime = require('mime-type')()\n//or create an instance and load mime-db. you need `npm install mime-db`\nvar mime = require('mime-type/with-db')\n//it equals to:\nvar db = require('mime-db')\nvar mime = require('mime-type')(db)\n```\n\nAll functions return `undefined` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json')             // 'application/json'\nmime.lookup('.md')              // 'text/x-markdown'\nmime.lookup('file.html')        // 'text/html'\nmime.lookup('folder/file.js')   // 'application/javascript'\nmime.lookup('folder/.htaccess') // false\n\nmime.lookup('cats') // false\n```\n\n### mime.glob(pattern)\n\nReturn all MIME types which matching a pattern\n\n```js\nmime.glob('*/*')             // ['application/octet-stream']\nmime.glob('*/*markdown')     // ['text/x-markdown']\nmime.glob('text/j*')         // ['text/jade', 'text/jsx']\nmime.glob('unknown/x')       // []\n```\n\n### mime.exist(type)\n\ntest whether a mime-type is exist.\nIt is an alias for `mime.hasOwnProperty`\n\n```js\nmime.exist('text/x-markdown') // true\nmime.exist('unknown/xxx')     // false\n```\n\n### mime.define(type, object, duplicationWay)\n\ndefine a new mime-type. the duplicationWay is the process way of duplication extensions:\n\n* mime.dupDefault: the default process way.\n* mime.dupOverwrite: the news overwrite the olds\n* mime.dupSkip: just skip it.\n* mime.dupAppend: append the news to the exist extensions.\n\nreturn the added extensions list if successful or `undefined`.\n\n```js\nmime.define('script/coffee', {\n  extensions: ['coffee', 'litcoffee', 'coffee.md']\n}, mime.dupAppend)\nmime.lookup ('coffee') //[ 'text/coffeescript', 'script/coffee' ]\n```\n\n### mime.delete(type)\n\nremove a specified mime-type\n\n```js\nmime.delete('script/coffee') //true\n```\n\n### mime.clear(filter)\n\nclear all or specified mime-types\n\nthe filter could be a string pattern or a function\n\nreturn the count of deleted mime-types.\n\n```js\nmime.clear() //clear all mime-types\nmime.clear('text/*') //clear the specified mime-types\nmime.clear(function(type, mime){\n  return type.substr(0,5) === 'text/'\n})\n```\n\n### mime.load(mimes)\n\nload a lot of mime-types. return the count of loaded mime-types.\n\n```js\nmime.clear() //clear all mime-types\nmime.load({\n  'script/coffee': {\n    extensions: ['coffee', 'coffee.md', 'litcoffee'],\n    compressible: true,\n    charset: 'utf-8',\n    defaultExtension: 'coffee.md'\n  },\n  'script/python': {\n    extensions: ['py', 'py.md', 'litpy'],\n    compressible: true,\n    charset: 'utf-8'\n  }\n})\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown')  // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n\n// from a full path\nmime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### var type = mime.types[extension]\n\nA map of content-types by extension.\n\n### [extensions...] = mime.extensions[type]\n\nA map of extensions by content-type.\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/mime-type.svg\n[npm-url]: https://npmjs.org/package/mime-type\n[node-version-image]: https://img.shields.io/node/v/mime-type.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/snowyu/mime-type.js/master.svg\n[travis-url]: https://travis-ci.org/snowyu/mime-type.js\n[coveralls-image]: https://img.shields.io/coveralls/snowyu/mime-type.js/master.svg\n[coveralls-url]: https://coveralls.io/r/snowyu/mime-type.js\n[downloads-image]: https://img.shields.io/npm/dm/mime-type.svg\n[downloads-url]: https://npmjs.org/package/mime-type\n","repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"users":{"panlw":true},"bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"license":"MIT","versions":{"2.9.0":{"name":"mime-type","description":"the custom content-type utility can work with meme-db.","version":"2.9.0","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":"npm test","files":["HISTORY.md","LICENSE","lib","src","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"612345d29c8cc30f2c10f4ad7a7aadbdd8c6aef6","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@2.9.0","_shasum":"eba8e2b213814340822adef6656dea9dfa7711a5","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"eba8e2b213814340822adef6656dea9dfa7711a5","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-2.9.0.tgz"},"directories":{}},"3.0.0":{"name":"mime-type","description":"the custom content-type utility can work with mime-db.","version":"3.0.0","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","mime-db","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":["test"],"files":["HISTORY.md","LICENSE","lib","src","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"4e4e90e58cb38448132025b44768c8f9a78c2f8d","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@3.0.0","_shasum":"54efcf88e88b649e3f05ca4befa52a6489077623","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"54efcf88e88b649e3f05ca4befa52a6489077623","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-3.0.0.tgz"},"directories":{}},"3.0.1":{"name":"mime-type","description":"the custom content-type utility can work with mime-db.","version":"3.0.1","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","mime-db","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","path-ex":"0.0.1","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":["test"],"files":["HISTORY.md","LICENSE","lib","src","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"6b8d415b2d73cb7a2e2b05e77ba008421ff0e1ad","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@3.0.1","_shasum":"e365286b9bb2b14fe705af9eb7bd970a81604511","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"e365286b9bb2b14fe705af9eb7bd970a81604511","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-3.0.1.tgz"},"directories":{}},"3.0.2":{"name":"mime-type","description":"the custom content-type utility can work with mime-db.","version":"3.0.2","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","mime-db","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","path-ex":"0.0.1","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":["test"],"files":["HISTORY.md","LICENSE","lib","src","with-db.js","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"1795d970f485a5fcfd590c0691650e2579b16543","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@3.0.2","_shasum":"ada94e3ae89eb80c6ddd2d2f417ea92ff693a6ed","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"ada94e3ae89eb80c6ddd2d2f417ea92ff693a6ed","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-3.0.2.tgz"},"directories":{}},"3.0.3":{"name":"mime-type","description":"the custom more powerful mime-type utility can work with mime-db.","version":"3.0.3","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","mime-db","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","path-ex":"0.0.1","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":["test"],"files":["HISTORY.md","LICENSE","lib","src","with-db.js","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"npm run pretest; istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"npm run pretest; istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"7617e3a0a3c5770fa353576252823c264d50b4f3","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@3.0.3","_shasum":"49bdcbe8d3b57f977ddfe7501d613cc5d6e91975","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"49bdcbe8d3b57f977ddfe7501d613cc5d6e91975","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-3.0.3.tgz"},"directories":{}},"3.0.4":{"name":"mime-type","description":"the custom more powerful mime-type utility can work with mime-db.","version":"3.0.4","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"license":"MIT","keywords":["mime","mime-db","types"],"repository":{"type":"git","url":"https://github.com/snowyu/mime-type.js"},"dependencies":{"media-typer":"^0.3.0","minimatch":"^2.0.8","path.js":"^1.0.4","util-ex":"^0.3.4"},"devDependencies":{"coffee-script":"^1.9.3","istanbul":"0.3.16","mime-db":"^1.14.0","mocha":"~1.21.5","pre-commit":"^1.0.10"},"pre-commit":["test"],"files":["HISTORY.md","LICENSE","lib","src","with-db.js","index.js"],"engines":{"node":">= 0.6"},"scripts":{"pretest":"coffee -o lib -c src/*.coffee","test":"mocha --reporter spec test/test.js","test-cov":"npm run pretest; istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js","test-travis":"npm run pretest; istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"},"gitHead":"70d31274f7e4f3d563b24e0203f006259457cf34","bugs":{"url":"https://github.com/snowyu/mime-type.js/issues"},"homepage":"https://github.com/snowyu/mime-type.js","_id":"mime-type@3.0.4","_shasum":"7ca4c17fc5eff0093c85602bcab5177c217409b3","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.36","_npmUser":{"name":"riceball","email":"snowyu.lee@gmail.com"},"maintainers":[{"name":"riceball","email":"snowyu.lee@gmail.com"}],"dist":{"shasum":"7ca4c17fc5eff0093c85602bcab5177c217409b3","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/mime-type/-/mime-type-3.0.4.tgz"},"directories":{}}},"name":"mime-type","contributors":[{"name":"Riceball LEE https://github.com/snowyu"},{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Jeremiah Senkpiel","email":"fishrock123@rocketmail.com","url":"https://searchbeam.jit.su"},{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"}],"time":{"modified":"2017-02-13T11:21:11.827Z","created":"2015-07-07T23:39:55.025Z","2.9.0":"2015-07-07T23:39:55.025Z","3.0.0":"2015-07-08T01:26:02.200Z","3.0.1":"2015-07-08T01:29:41.308Z","3.0.2":"2015-07-08T03:28:27.487Z","3.0.3":"2015-07-11T23:42:59.073Z","3.0.4":"2015-07-12T00:37:46.884Z"},"readmeFilename":"README.md","homepage":"https://github.com/snowyu/mime-type.js"}