Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 19 lines (12 sloc) 0.655 kb
55f8dde Add readme
Benjamin Thomas authored
1 A library for doing simple mime-type lookups.
2
3 var mime = require('mime');
4
5712bec @broofa update readme
authored
5 mime.lookup('/path/to/file.txt'); // => 'text/plain'
6 mime.lookup('file.txt'); // => 'text/plain'
7 mime.lookup('.txt'); // => 'text/plain'
8 mime.lookup('htm'); // => 'text/html'
55f8dde Add readme
Benjamin Thomas authored
9
5712bec @broofa update readme
authored
10 ... and extension lookups by mime-type
55f8dde Add readme
Benjamin Thomas authored
11
12a5ecd @broofa Simplify extension parsing. Fix readme typo
authored
12 mime.extension('text/html'); // => 'html'
17cf519 @broofa update readme
authored
13 mime.extension('application/octet-stream'); // => 'bin'
55f8dde Add readme
Benjamin Thomas authored
14
5712bec @broofa update readme
authored
15 It also includes rudimentary logic for determining charsets. (Useful in a web
16 framework):
55f8dde Add readme
Benjamin Thomas authored
17
5712bec @broofa update readme
authored
18 mime.charset.lookup('text/plain'); // => 'UTF-8'
Something went wrong with that request. Please try again.