arnaucube
arnaucube/socketioMEANseedPublic Self-hosted repository
socketioMEANseed/server/node_modules/mime-types/README.md
server/node_modules/mime-types/README.mdRaw
  1# mime-types
  2
  3[![NPM Version][npm-image]][npm-url]
  4[![NPM Downloads][downloads-image]][downloads-url]
  5[![Node.js Version][node-version-image]][node-version-url]
  6[![Build Status][travis-image]][travis-url]
  7[![Test Coverage][coveralls-image]][coveralls-url]
  8
  9The ultimate javascript content-type utility.
 10
 11Similar to [node-mime](https://github.com/broofa/node-mime), except:
 12
 13- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`,
 14  so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
 15- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
 16- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db)
 17- No `.define()` functionality
 18
 19Otherwise, the API is compatible.
 20
 21## Install
 22
 23```sh
 24$ npm install mime-types
 25```
 26
 27## Adding Types
 28
 29All mime types are based on [mime-db](https://github.com/jshttp/mime-db),
 30so open a PR there if you'd like to add mime types.
 31
 32## API
 33
 34```js
 35var mime = require('mime-types')
 36```
 37
 38All functions return `false` if input is invalid or not found.
 39
 40### mime.lookup(path)
 41
 42Lookup the content-type associated with a file.
 43
 44```js
 45mime.lookup('json')           // 'application/json'
 46mime.lookup('.md')            // 'text/x-markdown'
 47mime.lookup('file.html')      // 'text/html'
 48mime.lookup('folder/file.js') // 'application/javascript'
 49
 50mime.lookup('cats') // false
 51```
 52
 53### mime.contentType(type)
 54
 55Create a full content-type header given a content-type or extension.
 56
 57```js
 58mime.contentType('markdown')  // 'text/x-markdown; charset=utf-8'
 59mime.contentType('file.json') // 'application/json; charset=utf-8'
 60
 61// from a full path
 62mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
 63```
 64
 65### mime.extension(type)
 66
 67Get the default extension for a content-type.
 68
 69```js
 70mime.extension('application/octet-stream') // 'bin'
 71```
 72
 73### mime.charset(type)
 74
 75Lookup the implied default charset of a content-type.
 76
 77```js
 78mime.charset('text/x-markdown') // 'UTF-8'
 79```
 80
 81### var type = mime.types[extension]
 82
 83A map of content-types by extension.
 84
 85### [extensions...] = mime.extensions[type]
 86
 87A map of extensions by content-type.
 88
 89## License
 90
 91[MIT](LICENSE)
 92
 93[npm-image]: https://img.shields.io/npm/v/mime-types.svg
 94[npm-url]: https://npmjs.org/package/mime-types
 95[node-version-image]: https://img.shields.io/node/v/mime-types.svg
 96[node-version-url]: http://nodejs.org/download/
 97[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg
 98[travis-url]: https://travis-ci.org/jshttp/mime-types
 99[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg
100[coveralls-url]: https://coveralls.io/r/jshttp/mime-types
101[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg
102[downloads-url]: https://npmjs.org/package/mime-types