{"_id":"mimetype","_rev":"4628395","name":"mimetype","description":"A mime type catalog driven by filename extensions.","dist-tags":{"latest":"0.0.8"},"maintainers":[{"name":"rsdoiel","email":""}],"time":{"modified":"2026-04-10T18:43:59.000Z","created":"2012-09-13T14:51:18.670Z","0.0.8":"2015-11-17T21:19:42.945Z","0.0.7":"2015-03-24T17:41:46.496Z","0.0.6":"2015-01-29T18:21:20.999Z","0.0.5":"2013-06-02T18:30:16.192Z","0.0.4":"2012-10-08T18:43:31.102Z","0.0.3":"2012-09-13T14:51:18.670Z"},"users":{},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"repository":{"type":"git","url":"git+https://github.com/rsdoiel/mimetype-js.git"},"versions":{"0.0.8":{"name":"mimetype","version":"0.0.8","description":"A mime type catalog driven by filename extensions.","license":"BSD-2-Clause","main":"./mimetype.js","repository":{"type":"git","url":"git+https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"devDependencies":{"yui":"3.10.x"},"scripts":{"test":"node tests/mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"gitHead":"7c58fcb78f752f98dcd9f332c439af2ff2cdea8a","homepage":"https://github.com/rsdoiel/mimetype-js#readme","_id":"mimetype@0.0.8","_shasum":"fb30022794bbf7725cb7b46df820e87dd91fd086","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"dist":{"shasum":"fb30022794bbf7725cb7b46df820e87dd91fd086","size":34486,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.8.tgz"},"directories":{},"publish_time":1447795182945,"_hasShrinkwrap":false,"_cnpm_publish_time":1447795182945,"_cnpmcore_publish_time":"2021-12-16T17:25:35.246Z"},"0.0.7":{"name":"mimetype","version":"0.0.7","description":"A mime type catalog driven by filename extensions.","main":"./mimetype.js","repository":{"type":"git","url":"https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"devDependencies":{"yui":"3.10.x"},"scripts":{"test":"node tests/mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"gitHead":"f7635736a76639599e2dfd66a6cee7b314324ecb","homepage":"https://github.com/rsdoiel/mimetype-js","_id":"mimetype@0.0.7","_shasum":"a6b51a799e23d0b8ddb18d5e8258c958656e2478","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"dist":{"shasum":"a6b51a799e23d0b8ddb18d5e8258c958656e2478","size":33688,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.7.tgz"},"directories":{},"publish_time":1427218906496,"_hasShrinkwrap":false,"_cnpm_publish_time":1427218906496,"_cnpmcore_publish_time":"2021-12-16T17:25:35.527Z"},"0.0.6":{"name":"mimetype","version":"0.0.6","description":"A mime type catalog driven by filename extensions.","main":"./mimetype.js","repository":{"type":"git","url":"https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"devDependencies":{"yui":"3.10.x"},"scripts":{"test":"node tests/mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"gitHead":"b0eeb8ca64c83f96eaf429e24df52f686a9b6da8","homepage":"https://github.com/rsdoiel/mimetype-js","_id":"mimetype@0.0.6","_shasum":"9c2abfe311466fcb2247208d0304b8b2f5836e97","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"dist":{"shasum":"9c2abfe311466fcb2247208d0304b8b2f5836e97","size":33601,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.6.tgz"},"directories":{},"publish_time":1422555680999,"_hasShrinkwrap":false,"_cnpm_publish_time":1422555680999,"_cnpmcore_publish_time":"2021-12-16T17:25:35.736Z"},"0.0.5":{"name":"mimetype","version":"0.0.5","description":"A mime type catalog driven by filename extensions.","main":"./mimetype.js","repository":{"type":"git","url":"https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"devDependencies":{"yui":"3.10.x"},"scripts":{"test":"node tests/mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"readmeFilename":"README.md","_id":"mimetype@0.0.5","dist":{"shasum":"9cb586acfdd3ef08792eb8051de8b4fc3d7ed575","size":33268,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.5.tgz"},"_from":".","_npmVersion":"1.2.24","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"directories":{},"publish_time":1370197816192,"_hasShrinkwrap":false,"_cnpm_publish_time":1370197816192,"_cnpmcore_publish_time":"2021-12-16T17:25:35.939Z"},"0.0.4":{"name":"mimetype","version":"0.0.4","description":"A mime type catalog driven by filename extensions.","main":"./mimetype.js","repository":{"type":"git","url":"https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"dependencies":{"harness":">= 0.0.2"},"scripts":{"test":"node tests/mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"_id":"mimetype@0.0.4","dist":{"shasum":"2847b4595b9be3765317e0df5d2254fa97545dcb","size":33118,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.4.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"directories":{},"publish_time":1349721811102,"_hasShrinkwrap":false,"_cnpm_publish_time":1349721811102,"_cnpmcore_publish_time":"2021-12-16T17:25:36.166Z"},"0.0.3":{"name":"mimetype","version":"0.0.3","description":"A mime type catalog driven by filename extensions.","main":"./mimetype.js","repository":{"type":"git","url":"https://github.com/rsdoiel/mimetype-js.git"},"author":{"name":"R. S. Doiel","email":"rsdoiel@gmail.com","url":"https://github.com/rsdoiel"},"maintainers":[{"name":"rsdoiel","email":""}],"engines":{"node":">= 0.8","npm":">= 1"},"dependencies":{},"scripts":{"test":"node mimetype_test.js"},"bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"_id":"mimetype@0.0.3","dist":{"shasum":"488cc24f62fe8bc2e472e66ae52d451a638ccdd1","size":33416,"noattachment":false,"key":"/mimetype/-/mimetype-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/mimetype/download/mimetype-0.0.3.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"rsdoiel","email":"rsdoiel@gmail.com"},"directories":{},"publish_time":1347547878670,"_hasShrinkwrap":false,"_cnpm_publish_time":1347547878670,"_cnpmcore_publish_time":"2021-12-16T17:25:36.377Z"}},"readme":"[![build status](https://secure.travis-ci.org/rsdoiel/mimetype-js.png)](http://travis-ci.org/rsdoiel/mimetype-js)\nmimetype-js\n===========\n\n# Overview\n\nI find keep making these file extension lookup tables for mime types.  It's \nabout time I put it in a module to save me the trouble.\n\n# Examples\n\n## general case\n\n```JavaScript\n\tvar mimetype = require('mimetype');\n\t\n\tconsole.log(mimetype.lookup(\"myfile.txt\")); // Should display text/plain\n\tmimetype.set('.exotic', 'x-application/experimental'); // Add/update a mime type in the catalog\n\tconsole.log(mimetype.lookup(\"myfile.exotic\")); // Should display x-application/experimental\n\tmimetype.del('.exotic'); // Removes the mime type from the catalog\n\tconsole.log(mimetype.lookup(\"myfile.exitoc\")); // Should display false\n\tmimetype.forEach(function (ext, mime_type_string) {\n\t\tconsole.log(ext, mime_type_string); // Display the extension and matching mimetype in catalog\n\t});\n```\n\n## Special cases\n\nSometimes detecting by filename extensions isn't work and you want to \ndefault to a general purposes mime-type (e.g. text/plain, application/octet-stream).\n\n```JavaScript\n\tvar mimetype = require('mimetype');\n\t\n\t// This should display 0 (false)\n\tconsole.log(mimetype.lookup(\"filename.unknownMimeType\");\n\t// This should display the string text/plain\n\tconsole.log(mimetype.lookup(\"filename.unknownMimeType\", false, \"text/plain\");\n\t// This should display the string text/plain; charset=UTF-8\n\tconsole.log(mimetype.lookup(\"filename.unknownMimeType\", \"UTF-8\", \"text/plain\");\n```\n\n## Using mimetype.js with MongoDB Shell\n\nWhile this was implemented as a NodeJS module it also works under MongoDB's shell.\nInstead of including with a \"require\" you would load the JavaScript file _load-mimetype.js_.\n\n```JavaScript\n\tload(\"./extras/load-mimetype.js\");\n\tprint(\"Check the mime type of test.txt:\" + MimeType.lookup(\"test.txt\"));\n```\n\nThis would display something like-\n\n```shell\n\tMongoDB shell version: 2.2.0\n\tconnecting to: test\n\t> load(\"./extras/load-mimetype.js\");\n\t> print(\"Check the mime type of test.txt: \" + MimeType.lookup(\"test.txt\"));\n\tCheck the mime type of test.txt: text/plain\n\t> \n```\n","_attachments":{},"homepage":"https://github.com/rsdoiel/mimetype-js#readme","bugs":{"url":"http://github.com/rsdoiel/mimetype-js/issues"},"license":"BSD-2-Clause"}