Template Upload
This commit is contained in:
19
node_modules/mime/LICENSE
generated
vendored
Normal file
19
node_modules/mime/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
|
||||
|
||||
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.
|
50
node_modules/mime/README.md
generated
vendored
Normal file
50
node_modules/mime/README.md
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# mime
|
||||
|
||||
Support for mapping between file extensions and MIME types. This module uses the latest version of the Apache "mime.types" file (maps over 620 types to 800+ extensions). It is also trivially easy to add your own types and extensions, should you need to do that.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
npm install mime
|
||||
|
||||
## API - Queries
|
||||
|
||||
### 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:
|
||||
|
||||
var mime = require('mime');
|
||||
|
||||
mime.lookup('/path/to/file.txt'); // => 'text/plain'
|
||||
mime.lookup('file.txt'); // => 'text/plain'
|
||||
mime.lookup('.txt'); // => 'text/plain'
|
||||
mime.lookup('htm'); // => 'text/html'
|
||||
|
||||
### mime.extension(type) - lookup the default extension for type
|
||||
|
||||
mime.extension('text/html'); // => 'html'
|
||||
mime.extension('application/octet-stream'); // => 'bin'
|
||||
|
||||
### mime.charsets.lookup() - map mime-type to charset
|
||||
|
||||
mime.charsets.lookup('text/plain'); // => 'UTF-8'
|
||||
|
||||
(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
|
||||
|
||||
## API - Customizing
|
||||
|
||||
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
|
||||
|
||||
mime.define({
|
||||
'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
|
||||
'application/x-my-type': ['x-mt', 'x-mtt'],
|
||||
// etc ...
|
||||
});
|
||||
|
||||
mime.lookup('x-sft'); // => 'text/x-some-format'
|
||||
mime.extension('text/x-some-format'); // => 'x-sf'
|
||||
|
||||
### mime.load(filepath) - Load mappings from an Apache ".types" format file
|
||||
|
||||
mime.load('./my_project.types');
|
92
node_modules/mime/mime.js
generated
vendored
Normal file
92
node_modules/mime/mime.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
var path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
var mime = module.exports = {
|
||||
/** Map of extension to mime type */
|
||||
types: {},
|
||||
|
||||
/** Map of mime type to extension */
|
||||
extensions :{},
|
||||
|
||||
/**
|
||||
* Define mimetype -> extension mappings. Each key is a mime-type that maps
|
||||
* to an array of extensions associated with the type. The first extension is
|
||||
* used as the default extension for the type.
|
||||
*
|
||||
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
|
||||
*
|
||||
* @param map (Object) type definitions
|
||||
*/
|
||||
define: function(map) {
|
||||
for (var type in map) {
|
||||
var exts = map[type];
|
||||
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
mime.types[exts[i]] = type;
|
||||
}
|
||||
|
||||
// Default extension is the first one we encounter
|
||||
if (!mime.extensions[type]) {
|
||||
mime.extensions[type] = exts[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Load an Apache2-style ".types" file
|
||||
*
|
||||
* This may be called multiple times (it's expected). Where files declare
|
||||
* overlapping types/extensions, the last file wins.
|
||||
*
|
||||
* @param file (String) path of file to load.
|
||||
*/
|
||||
load: function(file) {
|
||||
// Read file and split into lines
|
||||
var map = {},
|
||||
content = fs.readFileSync(file, 'ascii'),
|
||||
lines = content.split(/[\r\n]+/);
|
||||
|
||||
lines.forEach(function(line, lineno) {
|
||||
// Clean up whitespace/comments, and split into fields
|
||||
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
|
||||
map[fields.shift()] = fields;
|
||||
});
|
||||
|
||||
mime.define(map);
|
||||
},
|
||||
|
||||
/**
|
||||
* Lookup a mime type based on extension
|
||||
*/
|
||||
lookup: function(path, fallback) {
|
||||
var ext = path.replace(/.*[\.\/]/, '').toLowerCase();
|
||||
return mime.types[ext] || fallback || mime.default_type;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return file extension associated with a mime type
|
||||
*/
|
||||
extension: function(mimeType) {
|
||||
return mime.extensions[mimeType];
|
||||
},
|
||||
|
||||
/**
|
||||
* Lookup a charset based on mime type.
|
||||
*/
|
||||
charsets: {
|
||||
lookup: function (mimeType, fallback) {
|
||||
// Assume text types are utf8. Modify mime logic as needed.
|
||||
return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Load our local copy of
|
||||
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
mime.load(path.join(__dirname, 'types/mime.types'));
|
||||
|
||||
// Overlay enhancements submitted by the node.js community
|
||||
mime.load(path.join(__dirname, 'types/node.types'));
|
||||
|
||||
// Set the default type
|
||||
mime.default_type = mime.types.bin;
|
88
node_modules/mime/package.json
generated
vendored
Normal file
88
node_modules/mime/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"mime@1.2.4",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\express"
|
||||
]
|
||||
],
|
||||
"_defaultsLoaded": true,
|
||||
"_engineSupported": true,
|
||||
"_from": "mime@1.2.4",
|
||||
"_id": "mime@1.2.4",
|
||||
"_inCache": true,
|
||||
"_location": "/mime",
|
||||
"_nodeVersion": "v0.4.6",
|
||||
"_npmJsonOpts": {
|
||||
"contributors": false,
|
||||
"file": "/home/kieffer/.npm/mime/1.2.4/package/package.json",
|
||||
"serverjs": false,
|
||||
"wscript": false
|
||||
},
|
||||
"_npmVersion": "1.0.27",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "mime",
|
||||
"raw": "mime@1.2.4",
|
||||
"rawSpec": "1.2.4",
|
||||
"scope": null,
|
||||
"spec": "1.2.4",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/express",
|
||||
"/express/connect"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.4.tgz",
|
||||
"_shasum": "11b5fdaf29c2509255176b80ad520294f5de92b7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime@1.2.4",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\express",
|
||||
"author": {
|
||||
"email": "robert@broofa.com",
|
||||
"name": "Robert Kieffer",
|
||||
"url": "http://github.com/broofa"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Thomas",
|
||||
"email": "benjamin@benjaminthomas.org",
|
||||
"url": "http://github.com/bentomas"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A comprehensive library for mime-type mapping",
|
||||
"devDependencies": {
|
||||
"async_testing": ""
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "11b5fdaf29c2509255176b80ad520294f5de92b7",
|
||||
"tarball": "https://registry.npmjs.org/mime/-/mime-1.2.4.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"mime",
|
||||
"util"
|
||||
],
|
||||
"main": "mime.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
{
|
||||
"name": "bentomas",
|
||||
"email": "benjamin@benjaminthomas.org"
|
||||
}
|
||||
],
|
||||
"name": "mime",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/bentomas/node-mime.git"
|
||||
},
|
||||
"version": "1.2.4"
|
||||
}
|
79
node_modules/mime/test.js
generated
vendored
Normal file
79
node_modules/mime/test.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Requires the async_testing module
|
||||
*
|
||||
* Usage: node test.js
|
||||
*/
|
||||
var mime = require('./mime');
|
||||
exports["test mime lookup"] = function(test) {
|
||||
// easy
|
||||
test.equal('text/plain', mime.lookup('text.txt'));
|
||||
|
||||
// hidden file or multiple periods
|
||||
test.equal('text/plain', mime.lookup('.text.txt'));
|
||||
|
||||
// just an extension
|
||||
test.equal('text/plain', mime.lookup('.txt'));
|
||||
|
||||
// just an extension without a dot
|
||||
test.equal('text/plain', mime.lookup('txt'));
|
||||
|
||||
// default
|
||||
test.equal('application/octet-stream', mime.lookup('text.nope'));
|
||||
|
||||
// fallback
|
||||
test.equal('fallback', mime.lookup('text.fallback', 'fallback'));
|
||||
|
||||
test.finish();
|
||||
};
|
||||
|
||||
exports["test extension lookup"] = function(test) {
|
||||
// easy
|
||||
test.equal('txt', mime.extension(mime.types.text));
|
||||
test.equal('html', mime.extension(mime.types.htm));
|
||||
test.equal('bin', mime.extension('application/octet-stream'));
|
||||
|
||||
test.finish();
|
||||
};
|
||||
|
||||
exports["test mime lookup uppercase"] = function(test) {
|
||||
// easy
|
||||
test.equal('text/plain', mime.lookup('TEXT.TXT'));
|
||||
|
||||
// just an extension
|
||||
test.equal('text/plain', mime.lookup('.TXT'));
|
||||
|
||||
// just an extension without a dot
|
||||
test.equal('text/plain', mime.lookup('TXT'));
|
||||
|
||||
// default
|
||||
test.equal('application/octet-stream', mime.lookup('TEXT.NOPE'));
|
||||
|
||||
// fallback
|
||||
test.equal('fallback', mime.lookup('TEXT.FALLBACK', 'fallback'));
|
||||
|
||||
test.finish();
|
||||
};
|
||||
|
||||
exports["test custom types"] = function(test) {
|
||||
test.equal('application/octet-stream', mime.lookup('file.buffer'));
|
||||
test.equal('audio/mp4', mime.lookup('file.m4a'));
|
||||
|
||||
test.finish();
|
||||
};
|
||||
|
||||
exports["test charset lookup"] = function(test) {
|
||||
// easy
|
||||
test.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
||||
|
||||
// none
|
||||
test.ok(typeof mime.charsets.lookup(mime.types.js) == 'undefined');
|
||||
|
||||
// fallback
|
||||
test.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
||||
|
||||
test.finish();
|
||||
};
|
||||
|
||||
if (module == require.main) {
|
||||
require('async_testing').run(__filename, process.ARGV);
|
||||
}
|
1479
node_modules/mime/types/mime.types
generated
vendored
Normal file
1479
node_modules/mime/types/mime.types
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
node_modules/mime/types/node.types
generated
vendored
Normal file
43
node_modules/mime/types/node.types
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# What: Google Chrome Extension
|
||||
# Why: To allow apps to (work) be served with the right content type header.
|
||||
# http://codereview.chromium.org/2830017
|
||||
# Added by: niftylettuce
|
||||
application/x-chrome-extension crx
|
||||
|
||||
# What: OTF Message Silencer
|
||||
# Why: To silence the "Resource interpreted as font but transferred with MIME
|
||||
# type font/otf" message that occurs in Google Chrome
|
||||
# Added by: niftylettuce
|
||||
font/opentype otf
|
||||
|
||||
# What: HTC support
|
||||
# Why: To properly render .htc files such as CSS3PIE
|
||||
# Added by: niftylettuce
|
||||
text/x-component htc
|
||||
|
||||
# What: HTML5 application cache manifest
|
||||
# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
|
||||
# per https://developer.mozilla.org/en/offline_resources_in_firefox
|
||||
# Added by: louisremi
|
||||
text/cache-manifest appcache manifest
|
||||
|
||||
# What: node binary buffer format
|
||||
# Why: semi-standard extension w/in the node community
|
||||
# Added by: tootallnate
|
||||
application/octet-stream buffer
|
||||
|
||||
# What: The "protected" MP-4 formats used by iTunes.
|
||||
# Why: Required for streaming music to browsers (?)
|
||||
# Added by: broofa
|
||||
application/mp4 m4p
|
||||
audio/mp4 m4a
|
||||
|
||||
# What: Music playlist format (http://en.wikipedia.org/wiki/M3U)
|
||||
# Why: See https://github.com/bentomas/node-mime/pull/6
|
||||
# Added by: mjrusso
|
||||
application/x-mpegURL m3u8
|
||||
|
||||
# What: Video format, Part of RFC1890
|
||||
# Why: See https://github.com/bentomas/node-mime/pull/6
|
||||
# Added by: mjrusso
|
||||
video/MP2T ts
|
Reference in New Issue
Block a user