blob: 3767a4e80fd25531ea67604fc1f143a702d63002 [file] [log] [blame]
{
"author": {
"name": "Robert Kieffer",
"email": "robert@broofa.com",
"url": "http://github.com/broofa"
},
"contributors": [
{
"name": "Benjamin Thomas",
"email": "benjamin@benjaminthomas.org",
"url": "http://github.com/bentomas"
}
],
"dependencies": {},
"description": "A comprehensive library for mime-type mapping",
"devDependencies": {
"async_testing": ""
},
"keywords": [
"util",
"mime"
],
"main": "mime.js",
"name": "mime",
"repository": {
"url": "http://github.com/bentomas/node-mime",
"type": "git"
},
"version": "1.2.4",
"readme": "# mime\n\nSupport for mapping between file extensions and MIME types. This module uses the latest version of the Apache \"mime.types\" file (maps over 620 types to 800+ extensions). It is also trivially easy to add your own types and extensions, should you need to do that.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file. This is method is case-insensitive. Everything in path up to and including the last '/' or '.' is ignored, so you can pass it paths, filenames, or extensions, like so:\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.txt'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.extension(type) - lookup the default extension for type\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup() - map mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Customizing\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types).\n### mime.define() - Add custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath) - Load mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/bentomas/node-mime/issues"
},
"homepage": "https://github.com/bentomas/node-mime",
"_id": "mime@1.2.4",
"dist": {
"shasum": "0f1a0da8e2ce35e5da7d1993f07528448e4af08f"
},
"_from": "mime@1.2.4",
"_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.4.tgz"
}