Comparing version 1.2.2 to 1.2.3
@@ -28,3 +28,6 @@ var path = require('path'), | ||
mime.extensions[type] = exts[0]; | ||
// Default extension is the first one we encounter | ||
if (!mime.extensions[type]) { | ||
mime.extensions[type] = exts[0]; | ||
} | ||
} | ||
@@ -77,3 +80,3 @@ }, | ||
// Assume text types are utf8. Modify mime logic as needed. | ||
return /^text\//.test(mimeType) ? 'UTF-8' : fallback; | ||
return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; | ||
} | ||
@@ -80,0 +83,0 @@ } |
@@ -10,3 +10,3 @@ { "name" : "mime" | ||
, "main" : "mime.js" | ||
, "version" : "1.2.2" | ||
, "version" : "1.2.3" | ||
} |
@@ -11,5 +11,6 @@ # mime | ||
## API | ||
## API - Queries | ||
### mime.lookup(path) - lookup the type for a file or extension | ||
### mime.lookup(path) | ||
Get 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: | ||
@@ -34,10 +35,5 @@ var mime = require('mime'); | ||
## "Can you add support for [some type/extension]?" | ||
## API - Customizing | ||
Start by adding support for the type in your project using the mime.define() or mime.load() methods (documented below). | ||
If there's a type that is shared across node.js modules, by different people, create an issue here and we'll add it if it makes sense. | ||
If the type in question applies to projects outside the node.js community (e.g. if [IANA](http://www.iana.org/assignments/media-types/) approves a new type) file a [bug with Apache](http://httpd.apache.org/bug_report.html) and create an issue here that links to it. | ||
The 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). | ||
### mime.define() - Add custom mime/extension mappings | ||
@@ -44,0 +40,0 @@ |
@@ -0,1 +1,7 @@ | ||
/** | ||
* Requires the async_testing module, which we're not bothering to ship as part | ||
* of this module. | ||
* | ||
* "npm install async_testing" | ||
*/ | ||
var mime = require('./mime'); | ||
@@ -2,0 +8,0 @@ exports["test mime lookup"] = function(test) { |
Sorry, the diff of this file is not supported yet
58700
138
51
0