-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 482c13c
Showing
16 changed files
with
7,645 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
.DS_Store* | ||
*.log | ||
*.gz | ||
|
||
node_modules | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_js: | ||
- "0.10" | ||
- "0.11" | ||
language: node_js | ||
script: "npm run test-travis" | ||
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Jonathan Ong [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
# mime-db | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![Build status][travis-image]][travis-url] | ||
[![License][license-image]][license-url] | ||
[![Downloads][downloads-image]][downloads-url] | ||
[![Gittip][gittip-image]][gittip-url] | ||
|
||
This is a database of all mime types. | ||
It consistents of a single, public JSON file and does not include any logic, | ||
allowing it to remain as unopinionated as possible with an API. | ||
It aggregates data from the following sources: | ||
|
||
- http://www.iana.org/assignments/media-types/media-types.xhtml | ||
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | ||
|
||
## Usage | ||
|
||
```bash | ||
npm i mime-db | ||
``` | ||
|
||
```js | ||
var db = require('mime-db'); | ||
|
||
// grab data on .js files | ||
var data = db['application/javascript']; | ||
``` | ||
|
||
If you're crazy enough to use this in the browser, | ||
you can just grab the JSON file: | ||
|
||
``` | ||
https://cdn.rawgit.com/jshttp/mime-db/master/db.json | ||
``` | ||
|
||
## Data Structure | ||
|
||
The JSON file is a map lookup for lowercased mime types. | ||
Each mime type has the following properties: | ||
|
||
- `.extensions[]` - known extensions associated with this mime type. | ||
- `.compressible` - whether a file of this type is can be gzipped. | ||
- `.charset` - the default charset associated with this type, if any. | ||
|
||
If unknown, every property could be `undefined`. | ||
|
||
## Repository Structure | ||
|
||
- `scripts` - these are scripts to run to build the database | ||
- `src/` - this is a folder of files created from remote sources like Apache and IANA | ||
- `lib/` - this is a folder of our own custom sources and db, which will be merged into `db.json` | ||
- `db.json` - the final built JSON file for end-user usage | ||
|
||
## Contributing | ||
|
||
To edit the database, only make PRs against files in the `lib/` folder. | ||
To update the build, run `npm run update` with node `v0.11.13+` (sorry). | ||
|
||
[npm-image]: https://img.shields.io/npm/v/mime-db.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/mime-db | ||
[github-tag]: http://img.shields.io/github/tag/jshttp/mime-db.svg?style=flat-square | ||
[github-url]: https://github.com/jshttp/mime-db/tags | ||
[travis-image]: https://img.shields.io/travis/jshttp/mime-db.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/jshttp/mime-db | ||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master | ||
[david-image]: http://img.shields.io/david/jshttp/mime-db.svg?style=flat-square | ||
[david-url]: https://david-dm.org/jshttp/mime-db | ||
[license-image]: http://img.shields.io/npm/l/mime-db.svg?style=flat-square | ||
[license-url]: LICENSE.md | ||
[downloads-image]: http://img.shields.io/npm/dm/mime-db.svg?style=flat-square | ||
[downloads-url]: https://npmjs.org/package/mime-db | ||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square | ||
[gittip-url]: https://www.gittip.com/jonathanong/ |
Oops, something went wrong.