Initial commit for OpenECOMP SDN-C OA&M
[sdnc/oam.git] / dgbuilder / dgeflows / node_modules / express / node_modules / accepts / node_modules / mime-types / README.md
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
9 The ultimate javascript content-type utility.
10
11 Similar 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
19 Otherwise, the API is compatible.
20
21 ## Install
22
23 ```sh
24 $ npm install mime-types
25 ```
26
27 ## Adding Types
28
29 All mime types are based on [mime-db](https://github.com/jshttp/mime-db),
30 so open a PR there if you'd like to add mime types.
31
32 ## API
33
34 ```js
35 var mime = require('mime-types')
36 ```
37
38 All functions return `false` if input is invalid or not found.
39
40 ### mime.lookup(path)
41
42 Lookup the content-type associated with a file.
43
44 ```js
45 mime.lookup('json')           // 'application/json'
46 mime.lookup('.md')            // 'text/x-markdown'
47 mime.lookup('file.html')      // 'text/html'
48 mime.lookup('folder/file.js') // 'application/javascript'
49
50 mime.lookup('cats') // false
51 ```
52
53 ### mime.contentType(type)
54
55 Create a full content-type header given a content-type or extension.
56
57 ```js
58 mime.contentType('markdown')  // 'text/x-markdown; charset=utf-8'
59 mime.contentType('file.json') // 'application/json; charset=utf-8'
60 ```
61
62 ### mime.extension(type)
63
64 Get the default extension for a content-type.
65
66 ```js
67 mime.extension('application/octet-stream') // 'bin'
68 ```
69
70 ### mime.charset(type)
71
72 Lookup the implied default charset of a content-type.
73
74 ```js
75 mime.charset('text/x-markdown') // 'UTF-8'
76 ```
77
78 ### var type = mime.types[extension]
79
80 A map of content-types by extension.
81
82 ### [extensions...] = mime.extensions[type]
83
84 A map of extensions by content-type.
85
86 ## License
87
88 [MIT](LICENSE)
89
90 [npm-image]: https://img.shields.io/npm/v/mime-types.svg?style=flat
91 [npm-url]: https://npmjs.org/package/mime-types
92 [node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
93 [node-version-url]: http://nodejs.org/download/
94 [travis-image]: https://img.shields.io/travis/jshttp/mime-types.svg?style=flat
95 [travis-url]: https://travis-ci.org/jshttp/mime-types
96 [coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types.svg?style=flat
97 [coveralls-url]: https://coveralls.io/r/jshttp/mime-types
98 [downloads-image]: https://img.shields.io/npm/dm/mime-types.svg?style=flat
99 [downloads-url]: https://npmjs.org/package/mime-types