mirror of
https://github.com/arnaucube/socketioMEANseed.git
synced 2026-02-07 03:36:47 +01:00
init
This commit is contained in:
19
server/node_modules/mime/LICENSE
generated
vendored
Normal file
19
server/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.
|
||||
66
server/node_modules/mime/README.md
generated
vendored
Normal file
66
server/node_modules/mime/README.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# mime
|
||||
|
||||
Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.
|
||||
|
||||
## 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, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
|
||||
|
||||
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.default_type
|
||||
Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
|
||||
|
||||
### mime.extension(type)
|
||||
Get 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 - Defining Custom Types
|
||||
|
||||
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/broofa/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'
|
||||
|
||||
The first entry in the extensions array is returned by `mime.extension()`. E.g.
|
||||
|
||||
mime.extension('text/x-some-format'); // => 'x-sf'
|
||||
|
||||
### mime.load(filepath)
|
||||
|
||||
Load mappings from an Apache ".types" format file
|
||||
|
||||
mime.load('./my_project.types');
|
||||
|
||||
The .types file format is simple - See the `types` dir for examples.
|
||||
114
server/node_modules/mime/mime.js
generated
vendored
Normal file
114
server/node_modules/mime/mime.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
function Mime() {
|
||||
// Map of extension -> mime type
|
||||
this.types = Object.create(null);
|
||||
|
||||
// Map of mime type -> extension
|
||||
this.extensions = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
Mime.prototype.define = function (map) {
|
||||
for (var type in map) {
|
||||
var exts = map[type];
|
||||
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
if (process.env.DEBUG_MIME && this.types[exts]) {
|
||||
console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
|
||||
this.types[exts] + ' to ' + type);
|
||||
}
|
||||
|
||||
this.types[exts[i]] = type;
|
||||
}
|
||||
|
||||
// Default extension is the first one we encounter
|
||||
if (!this.extensions[type]) {
|
||||
this.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.
|
||||
*/
|
||||
Mime.prototype.load = function(file) {
|
||||
|
||||
this._loading = file;
|
||||
// Read file and split into lines
|
||||
var map = {},
|
||||
content = fs.readFileSync(file, 'ascii'),
|
||||
lines = content.split(/[\r\n]+/);
|
||||
|
||||
lines.forEach(function(line) {
|
||||
// Clean up whitespace/comments, and split into fields
|
||||
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
|
||||
map[fields.shift()] = fields;
|
||||
});
|
||||
|
||||
this.define(map);
|
||||
|
||||
this._loading = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup a mime type based on extension
|
||||
*/
|
||||
Mime.prototype.lookup = function(path, fallback) {
|
||||
var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
|
||||
|
||||
return this.types[ext] || fallback || this.default_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return file extension associated with a mime type
|
||||
*/
|
||||
Mime.prototype.extension = function(mimeType) {
|
||||
var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
|
||||
return this.extensions[type];
|
||||
};
|
||||
|
||||
// Default instance
|
||||
var mime = new Mime();
|
||||
|
||||
// Load local copy of
|
||||
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
mime.load(path.join(__dirname, 'types/mime.types'));
|
||||
|
||||
// Load additional types from node.js community
|
||||
mime.load(path.join(__dirname, 'types/node.types'));
|
||||
|
||||
// Default type
|
||||
mime.default_type = mime.lookup('bin');
|
||||
|
||||
//
|
||||
// Additional API specific to the default instance
|
||||
//
|
||||
|
||||
mime.Mime = Mime;
|
||||
|
||||
/**
|
||||
* Lookup a charset based on mime type.
|
||||
*/
|
||||
mime.charsets = {
|
||||
lookup: function(mimeType, fallback) {
|
||||
// Assume text types are utf8
|
||||
return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = mime;
|
||||
90
server/node_modules/mime/package.json
generated
vendored
Normal file
90
server/node_modules/mime/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "mime@1.2.11",
|
||||
"scope": null,
|
||||
"escapedName": "mime",
|
||||
"name": "mime",
|
||||
"rawSpec": "1.2.11",
|
||||
"spec": "1.2.11",
|
||||
"type": "version"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/node_modules/send"
|
||||
]
|
||||
],
|
||||
"_from": "mime@1.2.11",
|
||||
"_id": "mime@1.2.11",
|
||||
"_inCache": true,
|
||||
"_location": "/mime",
|
||||
"_npmUser": {
|
||||
"name": "broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
"_npmVersion": "1.3.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "mime@1.2.11",
|
||||
"scope": null,
|
||||
"escapedName": "mime",
|
||||
"name": "mime",
|
||||
"rawSpec": "1.2.11",
|
||||
"spec": "1.2.11",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/send"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
|
||||
"_shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "mime@1.2.11",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/node_modules/send",
|
||||
"author": {
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/broofa/node-mime/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Thomas",
|
||||
"email": "benjamin@benjaminthomas.org",
|
||||
"url": "http://github.com/bentomas"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A comprehensive library for mime-type mapping",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
|
||||
"tarball": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/broofa/node-mime#readme",
|
||||
"keywords": [
|
||||
"util",
|
||||
"mime"
|
||||
],
|
||||
"main": "mime.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
{
|
||||
"name": "bentomas",
|
||||
"email": "benjamin@benjaminthomas.org"
|
||||
}
|
||||
],
|
||||
"name": "mime",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/broofa/node-mime.git",
|
||||
"type": "git"
|
||||
},
|
||||
"version": "1.2.11"
|
||||
}
|
||||
84
server/node_modules/mime/test.js
generated
vendored
Normal file
84
server/node_modules/mime/test.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Usage: node test.js
|
||||
*/
|
||||
|
||||
var mime = require('./mime');
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
|
||||
function eq(a, b) {
|
||||
console.log('Test: ' + a + ' === ' + b);
|
||||
assert.strictEqual.apply(null, arguments);
|
||||
}
|
||||
|
||||
console.log(Object.keys(mime.extensions).length + ' types');
|
||||
console.log(Object.keys(mime.types).length + ' extensions\n');
|
||||
|
||||
//
|
||||
// Test mime lookups
|
||||
//
|
||||
|
||||
eq('text/plain', mime.lookup('text.txt')); // normal file
|
||||
eq('text/plain', mime.lookup('TEXT.TXT')); // uppercase
|
||||
eq('text/plain', mime.lookup('dir/text.txt')); // dir + file
|
||||
eq('text/plain', mime.lookup('.text.txt')); // hidden file
|
||||
eq('text/plain', mime.lookup('.txt')); // nameless
|
||||
eq('text/plain', mime.lookup('txt')); // extension-only
|
||||
eq('text/plain', mime.lookup('/txt')); // extension-less ()
|
||||
eq('text/plain', mime.lookup('\\txt')); // Windows, extension-less
|
||||
eq('application/octet-stream', mime.lookup('text.nope')); // unrecognized
|
||||
eq('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
|
||||
|
||||
//
|
||||
// Test extensions
|
||||
//
|
||||
|
||||
eq('txt', mime.extension(mime.types.text));
|
||||
eq('html', mime.extension(mime.types.htm));
|
||||
eq('bin', mime.extension('application/octet-stream'));
|
||||
eq('bin', mime.extension('application/octet-stream '));
|
||||
eq('html', mime.extension(' text/html; charset=UTF-8'));
|
||||
eq('html', mime.extension('text/html; charset=UTF-8 '));
|
||||
eq('html', mime.extension('text/html; charset=UTF-8'));
|
||||
eq('html', mime.extension('text/html ; charset=UTF-8'));
|
||||
eq('html', mime.extension('text/html;charset=UTF-8'));
|
||||
eq('html', mime.extension('text/Html;charset=UTF-8'));
|
||||
eq(undefined, mime.extension('unrecognized'));
|
||||
|
||||
//
|
||||
// Test node.types lookups
|
||||
//
|
||||
|
||||
eq('application/font-woff', mime.lookup('file.woff'));
|
||||
eq('application/octet-stream', mime.lookup('file.buffer'));
|
||||
eq('audio/mp4', mime.lookup('file.m4a'));
|
||||
eq('font/opentype', mime.lookup('file.otf'));
|
||||
|
||||
//
|
||||
// Test charsets
|
||||
//
|
||||
|
||||
eq('UTF-8', mime.charsets.lookup('text/plain'));
|
||||
eq(undefined, mime.charsets.lookup(mime.types.js));
|
||||
eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
||||
|
||||
//
|
||||
// Test for overlaps between mime.types and node.types
|
||||
//
|
||||
|
||||
var apacheTypes = new mime.Mime(), nodeTypes = new mime.Mime();
|
||||
apacheTypes.load(path.join(__dirname, 'types/mime.types'));
|
||||
nodeTypes.load(path.join(__dirname, 'types/node.types'));
|
||||
|
||||
var keys = [].concat(Object.keys(apacheTypes.types))
|
||||
.concat(Object.keys(nodeTypes.types));
|
||||
keys.sort();
|
||||
for (var i = 1; i < keys.length; i++) {
|
||||
if (keys[i] == keys[i-1]) {
|
||||
console.warn('Warning: ' +
|
||||
'node.types defines ' + keys[i] + '->' + nodeTypes.types[keys[i]] +
|
||||
', mime.types defines ' + keys[i] + '->' + apacheTypes.types[keys[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\nOK');
|
||||
1588
server/node_modules/mime/types/mime.types
generated
vendored
Normal file
1588
server/node_modules/mime/types/mime.types
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
77
server/node_modules/mime/types/node.types
generated
vendored
Normal file
77
server/node_modules/mime/types/node.types
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# What: WebVTT
|
||||
# Why: To allow formats intended for marking up external text track resources.
|
||||
# http://dev.w3.org/html5/webvtt/
|
||||
# Added by: niftylettuce
|
||||
text/vtt vtt
|
||||
|
||||
# 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: HTC support
|
||||
# Why: To properly render .htc files such as CSS3PIE
|
||||
# Added by: niftylettuce
|
||||
text/x-component htc
|
||||
|
||||
# What: HTML5 application cache manifes ('.manifest' extension)
|
||||
# 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 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: Video format, Part of RFC1890
|
||||
# Why: See https://github.com/bentomas/node-mime/pull/6
|
||||
# Added by: mjrusso
|
||||
video/MP2T ts
|
||||
|
||||
# What: EventSource mime type
|
||||
# Why: mime type of Server-Sent Events stream
|
||||
# http://www.w3.org/TR/eventsource/#text-event-stream
|
||||
# Added by: francois2metz
|
||||
text/event-stream event-stream
|
||||
|
||||
# What: Mozilla App manifest mime type
|
||||
# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests
|
||||
# Added by: ednapiranha
|
||||
application/x-web-app-manifest+json webapp
|
||||
|
||||
# What: Lua file types
|
||||
# Why: Googling around shows de-facto consensus on these
|
||||
# Added by: creationix (Issue #45)
|
||||
text/x-lua lua
|
||||
application/x-lua-bytecode luac
|
||||
|
||||
# What: Markdown files, as per http://daringfireball.net/projects/markdown/syntax
|
||||
# Why: http://stackoverflow.com/questions/10701983/what-is-the-mime-type-for-markdown
|
||||
# Added by: avoidwork
|
||||
text/x-markdown markdown md mkd
|
||||
|
||||
# What: ini files
|
||||
# Why: because they're just text files
|
||||
# Added by: Matthew Kastor
|
||||
text/plain ini
|
||||
|
||||
# What: DASH Adaptive Streaming manifest
|
||||
# Why: https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video
|
||||
# Added by: eelcocramer
|
||||
application/dash+xml mdp
|
||||
|
||||
# What: OpenType font files - http://www.microsoft.com/typography/otspec/
|
||||
# Why: Browsers usually ignore the font MIME types and sniff the content,
|
||||
# but Chrome, shows a warning if OpenType fonts aren't served with
|
||||
# the `font/opentype` MIME type: http://i.imgur.com/8c5RN8M.png.
|
||||
# Added by: alrra
|
||||
font/opentype otf
|
||||
Reference in New Issue
Block a user