Commit 797f2779 authored by Leo Iannacone's avatar Leo Iannacone

update internal libraries

parent 63f37699
1.0.6 / 2014-06-24
==================
* deps: negotiator@0.4.7
1.0.5 / 2014-06-20 1.0.5 / 2014-06-20
================== ==================
......
# Compiled source # test
################### build.js
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files # # OS generated files #
###################### ######################
...@@ -35,18 +10,5 @@ Thumbs.db ...@@ -35,18 +10,5 @@ Thumbs.db
# Node.js # # Node.js #
########### ###########
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules node_modules
npm-debug.log npm-debug.log
language: node_js language: node_js
node_js: node_js:
- "0.8"
- "0.10" - "0.10"
- "0.11"
matrix:
allow_failures:
- node_js: "0.11"
fast_finish: true
before_install:
# remove build script deps before install
- node -pe 'f="./package.json";p=require(f);d=p.devDependencies;for(k in d){if("co"===k.substr(0,2))delete d[k]}require("fs").writeFileSync(f,JSON.stringify(p,null,2))'
# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) # mime-types
[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)
The ultimate javascript content-type utility. The ultimate javascript content-type utility.
...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility. ...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility.
$ npm install mime-types $ npm install mime-types
``` ```
#### Similar to [mime](https://github.com/broofa/node-mime) except: #### Similar to [node-mime](https://github.com/broofa/node-mime), except:
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. - No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- Additional mime types are added such as jade and stylus. Feel free to add more! - Additional mime types are added such as jade and stylus. Feel free to add more!
- Browser support via Browserify and Component by converting lists to JSON files. - Browser support via Browserify and Component by converting lists to JSON files.
......
...@@ -8,6 +8,7 @@ even if it's from an unofficial source. ...@@ -8,6 +8,7 @@ even if it's from an unofficial source.
- `text/coffeescript` - http://coffeescript.org/#scripts - `text/coffeescript` - http://coffeescript.org/#scripts
- `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started - `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started
- `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml - `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml
- `text.jsx` - http://facebook.github.io/react/docs/getting-started.html [[2]](https://github.com/facebook/react/blob/f230e0a03154e6f8a616e0da1fb3d97ffa1a6472/vendor/browser-transforms.js#L210)
[Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types) [Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types)
......
/**
* http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
* https://github.com/broofa/node-mime/blob/master/types/node.types
*
* Convert these text files to JSON for browser usage.
*/
var co = require('co')
var fs = require('fs')
var path = require('path')
var cogent = require('cogent')
function* get(url) {
var res = yield* cogent(url, {
string: true
})
if (res.statusCode !== 200)
throw new Error('got status code ' + res.statusCode + ' from ' + url)
var text = res.text
var json = {}
// http://en.wikipedia.org/wiki/Internet_media_type#Naming
/**
* Mime types and associated extensions are stored in the form:
*
* <type> <ext> <ext> <ext>
*
* And some are commented out with a leading `#` because they have no associated extensions.
* This regexp checks whether a single line matches this format, ignoring lines that are just comments.
* We could also just remove all lines that start with `#` if we want to make the JSON files smaller
* and ignore all mime types without associated extensions.
*/
var re = /^(?:# )?([\w-]+\/[\w\+\.-]+)(?:\s+\w+)*$/
text = text.split('\n')
.filter(Boolean)
.forEach(function (line) {
line = line.trim()
if (!line) return
var match = re.exec(line)
if (!match) return
// remove the leading # and <type> and return all the <ext>s
json[match[1]] = line.replace(/^(?:# )?([\w-]+\/[\w\+\.-]+)/, '')
.split(/\s+/)
.filter(Boolean)
})
fs.writeFileSync('lib/' + path.basename(url).split('.')[0] + '.json',
JSON.stringify(json, null, 2) + '\n')
}
co(function* () {
yield [
get('http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types'),
get('https://raw.githubusercontent.com/broofa/node-mime/master/types/node.types')
]
})()
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "0.1.0", "version": "0.1.0",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
......
...@@ -20,5 +20,8 @@ ...@@ -20,5 +20,8 @@
], ],
"text/x-handlebars-template": [ "text/x-handlebars-template": [
"hbs" "hbs"
],
"text/jsx": [
"jsx"
] ]
} }
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "1.0.0", "version": "1.0.1",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -26,14 +26,17 @@ ...@@ -26,14 +26,17 @@
"mocha": "1", "mocha": "1",
"should": "3" "should": "3"
}, },
"engines": {
"node": ">= 0.8.0"
},
"scripts": { "scripts": {
"test": "make test" "test": "make test"
}, },
"readme": "# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [mime](https://github.com/broofa/node-mime) except:\n\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n", "readme": "# mime-types\n[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [node-mime](https://github.com/broofa/node-mime), except:\n\n- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"bugs": { "bugs": {
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.0", "_id": "mime-types@1.0.1",
"_from": "mime-types@~1.0.0" "_from": "mime-types@~1.0.0"
} }
/**
* Usage: node test.js
*/
var mime = require("..");
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(false, 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.charset('text/plain'));
eq(false, mime.charset(mime.types.js));
eq('UTF-8', mime.charset('application/json'))
eq('UTF-8', mime.charsets.lookup('text/something'));
// eq('fallback', mime.charset('application/octet-stream', 'fallback'));
var assert = require('assert')
var mime = require('..')
var lookup = mime.lookup
var extension = mime.extension
var charset = mime.charset
var contentType = mime.contentType
describe('.lookup()', function () {
it('jade', function () {
assert.equal(lookup('jade'), 'text/jade')
assert.equal(lookup('.jade'), 'text/jade')
assert.equal(lookup('file.jade'), 'text/jade')
assert.equal(lookup('folder/file.jade'), 'text/jade')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
lookup({ noteven: "once" })
lookup(null)
lookup(true)
lookup(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(lookup('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.extension()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
extension({ noteven: "once" })
extension(null)
extension(true)
extension(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(extension('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.charset()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
charset({ noteven: "once" })
charset(null)
charset(true)
charset(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(charset('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.contentType()', function () {
it('html', function () {
assert.equal(contentType('html'), 'text/html; charset=utf-8')
})
it('text/html; charset=ascii', function () {
assert.equal(contentType('text/html; charset=ascii'), 'text/html; charset=ascii')
})
it('json', function () {
assert.equal(contentType('json'), 'application/json; charset=utf-8')
})
it('application/json', function () {
assert.equal(contentType('application/json'), 'application/json; charset=utf-8')
})
it('jade', function () {
assert.equal(contentType('jade'), 'text/jade; charset=utf-8')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
contentType({ noteven: "once" })
contentType(null)
contentType(true)
contentType(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(contentType('.jalksdjflakjsdjfasdf'), false)
})
})
...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) { ...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) {
function specify(language, spec) { function specify(language, spec) {
var p = parseLanguage(language) var p = parseLanguage(language)
if (!p) return null;
var s = 0; var s = 0;
if(spec.full === p.full){ if(spec.full === p.full){
s |= 4; s |= 4;
......
...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) { ...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) {
function specify(type, spec) { function specify(type, spec) {
var p = parseMediaType(type); var p = parseMediaType(type);
var s = 0; var s = 0;
if (!p) {
return null;
}
if(spec.type == p.type) { if(spec.type == p.type) {
s |= 4 s |= 4
} else if(spec.type != '*') { } else if(spec.type != '*') {
......
{ {
"name": "negotiator", "name": "negotiator",
"description": "HTTP content negotiation", "description": "HTTP content negotiation",
"version": "0.4.6", "version": "0.4.7",
"author": { "author": {
"name": "Federico Romero", "name": "Federico Romero",
"email": "federico.romero@outboxlabs.com" "email": "federico.romero@outboxlabs.com"
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
"url": "https://github.com/federomero/negotiator/issues" "url": "https://github.com/federomero/negotiator/issues"
}, },
"dependencies": {}, "dependencies": {},
"_id": "negotiator@0.4.6", "_id": "negotiator@0.4.7",
"_from": "negotiator@0.4.6" "dist": {
"shasum": "8273ad98ad1c14fed21daa9a404fb6a102d47305"
},
"_from": "negotiator@0.4.7",
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz"
} }
{ {
"name": "accepts", "name": "accepts",
"description": "Higher-level content negotiation", "description": "Higher-level content negotiation",
"version": "1.0.5", "version": "1.0.6",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
}, },
"dependencies": { "dependencies": {
"mime-types": "~1.0.0", "mime-types": "~1.0.0",
"negotiator": "0.4.6" "negotiator": "0.4.7"
}, },
"devDependencies": { "devDependencies": {
"istanbul": "0.2.10", "istanbul": "0.2.11",
"mocha": "*", "mocha": "*",
"should": "*" "should": "*"
}, },
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
"bugs": { "bugs": {
"url": "https://github.com/expressjs/accepts/issues" "url": "https://github.com/expressjs/accepts/issues"
}, },
"_id": "accepts@1.0.5", "_id": "accepts@1.0.6",
"_from": "accepts@~1.0.5" "dist": {
"shasum": "fc9be3e5812513c8e758ea54d87f07275a5529d5"
},
"_from": "accepts@~1.0.5",
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.0.6.tgz"
} }
4.4.5 / 2014-06-26
==================
* deps: cookie-signature@1.0.4
- fix for timing attacks
4.4.4 / 2014-06-20 4.4.4 / 2014-06-20
================== ==================
......
1.0.6 / 2014-06-24
==================
* deps: negotiator@0.4.7
1.0.5 / 2014-06-20 1.0.5 / 2014-06-20
================== ==================
......
# Compiled source # test
################### build.js
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files # # OS generated files #
###################### ######################
...@@ -35,18 +10,5 @@ Thumbs.db ...@@ -35,18 +10,5 @@ Thumbs.db
# Node.js # # Node.js #
########### ###########
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules node_modules
npm-debug.log npm-debug.log
language: node_js language: node_js
node_js: node_js:
- "0.8"
- "0.10" - "0.10"
- "0.11"
matrix:
allow_failures:
- node_js: "0.11"
fast_finish: true
before_install:
# remove build script deps before install
- node -pe 'f="./package.json";p=require(f);d=p.devDependencies;for(k in d){if("co"===k.substr(0,2))delete d[k]}require("fs").writeFileSync(f,JSON.stringify(p,null,2))'
# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) # mime-types
[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)
The ultimate javascript content-type utility. The ultimate javascript content-type utility.
...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility. ...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility.
$ npm install mime-types $ npm install mime-types
``` ```
#### Similar to [mime](https://github.com/broofa/node-mime) except: #### Similar to [node-mime](https://github.com/broofa/node-mime), except:
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. - No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- Additional mime types are added such as jade and stylus. Feel free to add more! - Additional mime types are added such as jade and stylus. Feel free to add more!
- Browser support via Browserify and Component by converting lists to JSON files. - Browser support via Browserify and Component by converting lists to JSON files.
......
...@@ -8,6 +8,7 @@ even if it's from an unofficial source. ...@@ -8,6 +8,7 @@ even if it's from an unofficial source.
- `text/coffeescript` - http://coffeescript.org/#scripts - `text/coffeescript` - http://coffeescript.org/#scripts
- `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started - `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started
- `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml - `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml
- `text.jsx` - http://facebook.github.io/react/docs/getting-started.html [[2]](https://github.com/facebook/react/blob/f230e0a03154e6f8a616e0da1fb3d97ffa1a6472/vendor/browser-transforms.js#L210)
[Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types) [Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types)
......
/**
* http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
* https://github.com/broofa/node-mime/blob/master/types/node.types
*
* Convert these text files to JSON for browser usage.
*/
var co = require('co')
var fs = require('fs')
var path = require('path')
var cogent = require('cogent')
function* get(url) {
var res = yield* cogent(url, {
string: true
})
if (res.statusCode !== 200)
throw new Error('got status code ' + res.statusCode + ' from ' + url)
var text = res.text
var json = {}
// http://en.wikipedia.org/wiki/Internet_media_type#Naming
/**
* Mime types and associated extensions are stored in the form:
*
* <type> <ext> <ext> <ext>
*
* And some are commented out with a leading `#` because they have no associated extensions.
* This regexp checks whether a single line matches this format, ignoring lines that are just comments.
* We could also just remove all lines that start with `#` if we want to make the JSON files smaller
* and ignore all mime types without associated extensions.
*/
var re = /^(?:# )?([\w-]+\/[\w\+\.-]+)(?:\s+\w+)*$/
text = text.split('\n')
.filter(Boolean)
.forEach(function (line) {
line = line.trim()
if (!line) return
var match = re.exec(line)
if (!match) return
// remove the leading # and <type> and return all the <ext>s
json[match[1]] = line.replace(/^(?:# )?([\w-]+\/[\w\+\.-]+)/, '')
.split(/\s+/)
.filter(Boolean)
})
fs.writeFileSync('lib/' + path.basename(url).split('.')[0] + '.json',
JSON.stringify(json, null, 2) + '\n')
}
co(function* () {
yield [
get('http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types'),
get('https://raw.githubusercontent.com/broofa/node-mime/master/types/node.types')
]
})()
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "0.1.0", "version": "0.1.0",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
......
...@@ -20,5 +20,8 @@ ...@@ -20,5 +20,8 @@
], ],
"text/x-handlebars-template": [ "text/x-handlebars-template": [
"hbs" "hbs"
],
"text/jsx": [
"jsx"
] ]
} }
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "1.0.0", "version": "1.0.1",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -26,14 +26,17 @@ ...@@ -26,14 +26,17 @@
"mocha": "1", "mocha": "1",
"should": "3" "should": "3"
}, },
"engines": {
"node": ">= 0.8.0"
},
"scripts": { "scripts": {
"test": "make test" "test": "make test"
}, },
"readme": "# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [mime](https://github.com/broofa/node-mime) except:\n\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n", "readme": "# mime-types\n[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [node-mime](https://github.com/broofa/node-mime), except:\n\n- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"bugs": { "bugs": {
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.0", "_id": "mime-types@1.0.1",
"_from": "mime-types@~1.0.0" "_from": "mime-types@~1.0.0"
} }
/**
* Usage: node test.js
*/
var mime = require("..");
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(false, 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.charset('text/plain'));
eq(false, mime.charset(mime.types.js));
eq('UTF-8', mime.charset('application/json'))
eq('UTF-8', mime.charsets.lookup('text/something'));
// eq('fallback', mime.charset('application/octet-stream', 'fallback'));
var assert = require('assert')
var mime = require('..')
var lookup = mime.lookup
var extension = mime.extension
var charset = mime.charset
var contentType = mime.contentType
describe('.lookup()', function () {
it('jade', function () {
assert.equal(lookup('jade'), 'text/jade')
assert.equal(lookup('.jade'), 'text/jade')
assert.equal(lookup('file.jade'), 'text/jade')
assert.equal(lookup('folder/file.jade'), 'text/jade')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
lookup({ noteven: "once" })
lookup(null)
lookup(true)
lookup(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(lookup('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.extension()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
extension({ noteven: "once" })
extension(null)
extension(true)
extension(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(extension('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.charset()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
charset({ noteven: "once" })
charset(null)
charset(true)
charset(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(charset('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.contentType()', function () {
it('html', function () {
assert.equal(contentType('html'), 'text/html; charset=utf-8')
})
it('text/html; charset=ascii', function () {
assert.equal(contentType('text/html; charset=ascii'), 'text/html; charset=ascii')
})
it('json', function () {
assert.equal(contentType('json'), 'application/json; charset=utf-8')
})
it('application/json', function () {
assert.equal(contentType('application/json'), 'application/json; charset=utf-8')
})
it('jade', function () {
assert.equal(contentType('jade'), 'text/jade; charset=utf-8')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
contentType({ noteven: "once" })
contentType(null)
contentType(true)
contentType(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(contentType('.jalksdjflakjsdjfasdf'), false)
})
})
...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) { ...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) {
function specify(language, spec) { function specify(language, spec) {
var p = parseLanguage(language) var p = parseLanguage(language)
if (!p) return null;
var s = 0; var s = 0;
if(spec.full === p.full){ if(spec.full === p.full){
s |= 4; s |= 4;
......
...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) { ...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) {
function specify(type, spec) { function specify(type, spec) {
var p = parseMediaType(type); var p = parseMediaType(type);
var s = 0; var s = 0;
if (!p) {
return null;
}
if(spec.type == p.type) { if(spec.type == p.type) {
s |= 4 s |= 4
} else if(spec.type != '*') { } else if(spec.type != '*') {
......
{ {
"name": "negotiator", "name": "negotiator",
"description": "HTTP content negotiation", "description": "HTTP content negotiation",
"version": "0.4.6", "version": "0.4.7",
"author": { "author": {
"name": "Federico Romero", "name": "Federico Romero",
"email": "federico.romero@outboxlabs.com" "email": "federico.romero@outboxlabs.com"
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
"url": "https://github.com/federomero/negotiator/issues" "url": "https://github.com/federomero/negotiator/issues"
}, },
"dependencies": {}, "dependencies": {},
"_id": "negotiator@0.4.6", "_id": "negotiator@0.4.7",
"_from": "negotiator@0.4.6" "dist": {
"shasum": "8273ad98ad1c14fed21daa9a404fb6a102d47305"
},
"_from": "negotiator@0.4.7",
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz"
} }
{ {
"name": "accepts", "name": "accepts",
"description": "Higher-level content negotiation", "description": "Higher-level content negotiation",
"version": "1.0.5", "version": "1.0.6",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
}, },
"dependencies": { "dependencies": {
"mime-types": "~1.0.0", "mime-types": "~1.0.0",
"negotiator": "0.4.6" "negotiator": "0.4.7"
}, },
"devDependencies": { "devDependencies": {
"istanbul": "0.2.10", "istanbul": "0.2.11",
"mocha": "*", "mocha": "*",
"should": "*" "should": "*"
}, },
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
"bugs": { "bugs": {
"url": "https://github.com/expressjs/accepts/issues" "url": "https://github.com/expressjs/accepts/issues"
}, },
"_id": "accepts@1.0.5", "_id": "accepts@1.0.6",
"_from": "accepts@~1.0.5" "dist": {
"shasum": "fc9be3e5812513c8e758ea54d87f07275a5529d5"
},
"_from": "accepts@~1.0.5",
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.0.6.tgz"
} }
...@@ -35,9 +35,5 @@ ...@@ -35,9 +35,5 @@
"url": "https://github.com/brianloveswords/buffer-crc32/issues" "url": "https://github.com/brianloveswords/buffer-crc32/issues"
}, },
"_id": "buffer-crc32@0.2.3", "_id": "buffer-crc32@0.2.3",
"dist": { "_from": "buffer-crc32@0.2.3"
"shasum": "44c26c0f0a5605e82f4adff159922a34c111f688"
},
"_from": "buffer-crc32@0.2.3",
"_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz"
} }
1.0.4 / 2014-06-25
==================
* corrected avoidance of timing attacks (thanks @tenbits!)
1.0.3 / 2014-01-28 1.0.3 / 2014-01-28
================== ==================
* fix for timing attacks * [incorrect] fix for timing attacks
1.0.2 / 2014-01-28 1.0.2 / 2014-01-28
================== ==================
......
...@@ -39,5 +39,13 @@ exports.unsign = function(val, secret){ ...@@ -39,5 +39,13 @@ exports.unsign = function(val, secret){
var str = val.slice(0, val.lastIndexOf('.')) var str = val.slice(0, val.lastIndexOf('.'))
, mac = exports.sign(str, secret); , mac = exports.sign(str, secret);
return exports.sign(mac, secret) == exports.sign(val, secret) ? str : false; return sha1(mac) == sha1(val) ? str : false;
}; };
/**
* Private
*/
function sha1(str){
return crypto.createHash('sha1').update(str).digest('hex');
}
{ {
"name": "cookie-signature", "name": "cookie-signature",
"version": "1.0.3", "version": "1.0.4",
"description": "Sign and unsign cookies", "description": "Sign and unsign cookies",
"keywords": [ "keywords": [
"cookie", "cookie",
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
"bugs": { "bugs": {
"url": "https://github.com/visionmedia/node-cookie-signature/issues" "url": "https://github.com/visionmedia/node-cookie-signature/issues"
}, },
"_id": "cookie-signature@1.0.3", "_id": "cookie-signature@1.0.4",
"_from": "cookie-signature@1.0.3" "dist": {
"shasum": "aa3b73d0f90834fd3fea70fbab15819cd3ca1441"
},
"_from": "cookie-signature@1.0.4",
"_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.4.tgz"
} }
...@@ -32,9 +32,5 @@ ...@@ -32,9 +32,5 @@
"url": "https://github.com/shtylman/node-cookie/issues" "url": "https://github.com/shtylman/node-cookie/issues"
}, },
"_id": "cookie@0.1.2", "_id": "cookie@0.1.2",
"dist": { "_from": "cookie@0.1.2"
"shasum": "1eef0dec7e54f653c66b69d1428efc5e3c52c0ef"
},
"_from": "cookie@0.1.2",
"_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz"
} }
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
"readme": "# parseurl\n\nParse a URL with memoization.\n\n## API\n\n### var pathname = parseurl(req)\n\n`pathname` can then be passed to a router or something.\n\n## LICENSE\n\n(The MIT License)\n\nCopyright (c) 2014 Jonathan Ong <me@jongleberry.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "readme": "# parseurl\n\nParse a URL with memoization.\n\n## API\n\n### var pathname = parseurl(req)\n\n`pathname` can then be passed to a router or something.\n\n## LICENSE\n\n(The MIT License)\n\nCopyright (c) 2014 Jonathan Ong <me@jongleberry.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"_id": "parseurl@1.0.1", "_id": "parseurl@1.0.1",
"_from": "parseurl@1.0.1", "_from": "parseurl@1.0.1"
"scripts": {}
} }
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
"url": "https://github.com/visionmedia/node-range-parser/issues" "url": "https://github.com/visionmedia/node-range-parser/issues"
}, },
"_id": "range-parser@1.0.0", "_id": "range-parser@1.0.0",
"_from": "range-parser@~1.0.0" "_from": "range-parser@1.0.0"
} }
...@@ -50,5 +50,9 @@ ...@@ -50,5 +50,9 @@
"url": "https://github.com/visionmedia/send/issues" "url": "https://github.com/visionmedia/send/issues"
}, },
"_id": "send@0.4.3", "_id": "send@0.4.3",
"_from": "send@0.4.3" "dist": {
"shasum": "20a847abeb294cfa679c9d6a43a03d931037661b"
},
"_from": "send@0.4.3",
"_resolved": "https://registry.npmjs.org/send/-/send-0.4.3.tgz"
} }
1.2.3 / 2014-06-11
==================
* deps: send@0.4.3
- Do not throw un-catchable error on file open race condition
- Use `escape-html` for HTML escaping
- deps: debug@1.0.2
- deps: finished@1.2.2
- deps: fresh@0.2.2
1.2.2 / 2014-06-09
==================
* deps: send@0.4.2
- fix "event emitter leak" warnings
- deps: debug@1.0.1
- deps: finished@1.2.1
1.2.1 / 2014-06-02
==================
* use `escape-html` for escaping
* deps: send@0.4.1
- Send `max-age` in `Cache-Control` in correct format
1.2.0 / 2014-05-29
==================
* deps: send@0.4.0
- Calculate ETag with md5 for reduced collisions
- Fix wrong behavior when index file matches directory
- Ignore stream errors after request ends
- Skip directories in index file search
- deps: debug@0.8.1
1.1.0 / 2014-04-24
==================
* Accept options directly to `send` module
* deps: send@0.3.0
1.0.4 / 2014-04-07
==================
* Resolve relative paths at middleware setup
* Use parseurl to parse the URL from request
1.0.3 / 2014-03-20
==================
* Do not rely on connect-like environments
1.0.2 / 2014-03-06
==================
* deps: send@0.2.0
1.0.1 / 2014-03-05
==================
* Add mime export for back-compat
1.0.0 / 2014-03-05
==================
* Genesis from `connect`
(The MIT License)
Copyright (c) 2010 Sencha Inc.
Copyright (c) 2011 LearnBoost
Copyright (c) 2011 TJ Holowaychuk
Copyright (c) 2014 Douglas Christopher Wilson
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.
# serve-static
[![NPM version](https://badge.fury.io/js/serve-static.svg)](http://badge.fury.io/js/serve-static)
[![Build Status](https://travis-ci.org/expressjs/serve-static.svg?branch=master)](https://travis-ci.org/expressjs/serve-static)
[![Coverage Status](https://img.shields.io/coveralls/expressjs/serve-static.svg?branch=master)](https://coveralls.io/r/expressjs/serve-static)
Previously `connect.static()`.
## Install
```sh
$ npm install serve-static
```
## API
```js
var serveStatic = require('serve-static')
```
### serveStatic(root, options)
Create a new middleware function to serve files from within a given root
directory. The file to serve will be determined by combining `req.url`
with the provided root directory.
Options:
- `hidden` Allow transfer of hidden files. defaults to `false`
- `index` Default file name, defaults to `'index.html'`
- `maxAge` Browser cache maxAge in milliseconds. defaults to `0`
- `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to `true`
## Examples
### Serve files with vanilla node.js http server
```js
var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
// Serve up public/ftp folder
var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})
// Create server
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
serve(req, res, done)
})
// Listen
server.listen(3000)
```
### Serve all files from ftp folder
```js
var connect = require('connect')
var serveStatic = require('serve-static')
var app = connect()
app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
app.listen(3000)
```
## License
The MIT License (MIT)
Copyright (c) 2014 Douglas Christopher Wilson
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.
/*!
* serve-static
* Copyright(c) 2010 Sencha Inc.
* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
*/
var escapeHtml = require('escape-html');
var parseurl = require('parseurl');
var resolve = require('path').resolve;
var send = require('send');
var url = require('url');
/**
* Static:
*
* Static file server with the given `root` path.
*
* Examples:
*
* var oneDay = 86400000;
* var serveStatic = require('serve-static');
*
* connect()
* .use(serveStatic(__dirname + '/public'))
*
* connect()
* .use(serveStatic(__dirname + '/public', { maxAge: oneDay }))
*
* Options:
*
* - `maxAge` Browser cache maxAge in milliseconds. defaults to 0
* - `hidden` Allow transfer of hidden files. defaults to false
* - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true
* - `index` Default file name, defaults to 'index.html'
*
* Further options are forwarded on to `send`.
*
* @param {String} root
* @param {Object} options
* @return {Function}
* @api public
*/
exports = module.exports = function(root, options){
options = extend({}, options);
// root required
if (!root) throw new TypeError('root path required');
// resolve root to absolute
root = resolve(root);
// default redirect
var redirect = false !== options.redirect;
// setup options for send
options.maxage = options.maxage || options.maxAge || 0;
options.root = root;
return function staticMiddleware(req, res, next) {
if ('GET' != req.method && 'HEAD' != req.method) return next();
var opts = extend({}, options);
var originalUrl = url.parse(req.originalUrl || req.url);
var path = parseurl(req).pathname;
if (path == '/' && originalUrl.pathname[originalUrl.pathname.length - 1] != '/') {
return directory();
}
function directory() {
if (!redirect) return next();
var target;
originalUrl.pathname += '/';
target = url.format(originalUrl);
res.statusCode = 303;
res.setHeader('Location', target);
res.end('Redirecting to ' + escapeHtml(target));
}
function error(err) {
if (404 == err.status) return next();
next(err);
}
send(req, path, opts)
.on('error', error)
.on('directory', directory)
.pipe(res);
};
};
/**
* Expose mime module.
*
* If you wish to extend the mime table use this
* reference to the "mime" module in the npm registry.
*/
exports.mime = send.mime;
/**
* Shallow clone a single object.
*
* @param {Object} obj
* @param {Object} source
* @return {Object}
* @api private
*/
function extend(obj, source) {
if (!source) return obj;
for (var prop in source) {
obj[prop] = source[prop];
}
return obj;
};
{
"name": "serve-static",
"description": "Serve static files",
"version": "1.2.3",
"author": {
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/expressjs/serve-static"
},
"dependencies": {
"escape-html": "1.0.1",
"parseurl": "1.0.1",
"send": "0.4.3"
},
"devDependencies": {
"istanbul": "0.2.10",
"mocha": "~1.20.0",
"should": "~4.0.0",
"supertest": "~0.13.0"
},
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "mocha --reporter dot --require should test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/"
},
"readme": "# serve-static\n\n[![NPM version](https://badge.fury.io/js/serve-static.svg)](http://badge.fury.io/js/serve-static)\n[![Build Status](https://travis-ci.org/expressjs/serve-static.svg?branch=master)](https://travis-ci.org/expressjs/serve-static)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/serve-static.svg?branch=master)](https://coveralls.io/r/expressjs/serve-static)\n\nPreviously `connect.static()`.\n\n## Install\n\n```sh\n$ npm install serve-static\n```\n\n## API\n\n```js\nvar serveStatic = require('serve-static')\n```\n\n### serveStatic(root, options)\n\nCreate a new middleware function to serve files from within a given root\ndirectory. The file to serve will be determined by combining `req.url`\nwith the provided root directory.\n\nOptions:\n\n- `hidden` Allow transfer of hidden files. defaults to `false`\n- `index` Default file name, defaults to `'index.html'`\n- `maxAge` Browser cache maxAge in milliseconds. defaults to `0`\n- `redirect` Redirect to trailing \"/\" when the pathname is a dir. defaults to `true`\n\n## Examples\n\n### Serve files with vanilla node.js http server\n\n```js\nvar finalhandler = require('finalhandler')\nvar http = require('http')\nvar serveStatic = require('serve-static')\n\n// Serve up public/ftp folder\nvar serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})\n\n// Create server\nvar server = http.createServer(function(req, res){\n var done = finalhandler(req, res)\n serve(req, res, done)\n})\n\n// Listen\nserver.listen(3000)\n```\n\n### Serve all files from ftp folder\n\n```js\nvar connect = require('connect')\nvar serveStatic = require('serve-static')\n\nvar app = connect()\n\napp.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))\napp.listen(3000)\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/expressjs/serve-static/issues"
},
"_id": "serve-static@1.2.3",
"dist": {
"shasum": "0d8f17dfa35aff543e12cb9ee964da30e415ede9"
},
"_from": "serve-static@1.2.3",
"_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.2.3.tgz"
}
...@@ -35,5 +35,9 @@ ...@@ -35,5 +35,9 @@
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.0", "_id": "mime-types@1.0.0",
"_from": "mime-types@~1.0.0" "dist": {
"shasum": "33e4be5d71804f65b64e01705aef24b8c6c0d76d"
},
"_from": "mime-types@1.0.0",
"_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-1.0.0.tgz"
} }
{ {
"name": "express", "name": "express",
"description": "Sinatra inspired web development framework", "description": "Sinatra inspired web development framework",
"version": "4.4.4", "version": "4.4.5",
"author": { "author": {
"name": "TJ Holowaychuk", "name": "TJ Holowaychuk",
"email": "tj@vision-media.ca" "email": "tj@vision-media.ca"
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"vary": "0.1.0", "vary": "0.1.0",
"cookie": "0.1.2", "cookie": "0.1.2",
"fresh": "0.2.2", "fresh": "0.2.2",
"cookie-signature": "1.0.3", "cookie-signature": "1.0.4",
"merge-descriptors": "0.0.2", "merge-descriptors": "0.0.2",
"utils-merge": "1.0.0", "utils-merge": "1.0.0",
"qs": "0.6.6", "qs": "0.6.6",
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
"bugs": { "bugs": {
"url": "https://github.com/visionmedia/express/issues" "url": "https://github.com/visionmedia/express/issues"
}, },
"_id": "express@4.4.4", "_id": "express@4.4.5",
"dist": { "dist": {
"shasum": "0c810bc8d3d28df2cacd6ba52cde143609ac13fa" "shasum": "95c69de656eb00e90c5ef8e3e0810c5169f21444"
}, },
"_from": "express@4.x", "_from": "express@4.x",
"_resolved": "https://registry.npmjs.org/express/-/express-4.4.4.tgz" "_resolved": "https://registry.npmjs.org/express/-/express-4.4.5.tgz"
} }
1.0.6 / 2014-06-24
==================
* deps: negotiator@0.4.7
1.0.5 / 2014-06-20 1.0.5 / 2014-06-20
================== ==================
......
# Compiled source # test
################### build.js
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files # # OS generated files #
###################### ######################
...@@ -35,18 +10,5 @@ Thumbs.db ...@@ -35,18 +10,5 @@ Thumbs.db
# Node.js # # Node.js #
########### ###########
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules node_modules
npm-debug.log npm-debug.log
language: node_js language: node_js
node_js: node_js:
- "0.8"
- "0.10" - "0.10"
- "0.11"
matrix:
allow_failures:
- node_js: "0.11"
fast_finish: true
before_install:
# remove build script deps before install
- node -pe 'f="./package.json";p=require(f);d=p.devDependencies;for(k in d){if("co"===k.substr(0,2))delete d[k]}require("fs").writeFileSync(f,JSON.stringify(p,null,2))'
# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) # mime-types
[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)
The ultimate javascript content-type utility. The ultimate javascript content-type utility.
...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility. ...@@ -8,10 +9,10 @@ The ultimate javascript content-type utility.
$ npm install mime-types $ npm install mime-types
``` ```
#### Similar to [mime](https://github.com/broofa/node-mime) except: #### Similar to [node-mime](https://github.com/broofa/node-mime), except:
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. - No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
- Additional mime types are added such as jade and stylus. Feel free to add more! - Additional mime types are added such as jade and stylus. Feel free to add more!
- Browser support via Browserify and Component by converting lists to JSON files. - Browser support via Browserify and Component by converting lists to JSON files.
......
...@@ -8,6 +8,7 @@ even if it's from an unofficial source. ...@@ -8,6 +8,7 @@ even if it's from an unofficial source.
- `text/coffeescript` - http://coffeescript.org/#scripts - `text/coffeescript` - http://coffeescript.org/#scripts
- `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started - `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started
- `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml - `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml
- `text.jsx` - http://facebook.github.io/react/docs/getting-started.html [[2]](https://github.com/facebook/react/blob/f230e0a03154e6f8a616e0da1fb3d97ffa1a6472/vendor/browser-transforms.js#L210)
[Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types) [Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types)
......
/**
* http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
* https://github.com/broofa/node-mime/blob/master/types/node.types
*
* Convert these text files to JSON for browser usage.
*/
var co = require('co')
var fs = require('fs')
var path = require('path')
var cogent = require('cogent')
function* get(url) {
var res = yield* cogent(url, {
string: true
})
if (res.statusCode !== 200)
throw new Error('got status code ' + res.statusCode + ' from ' + url)
var text = res.text
var json = {}
// http://en.wikipedia.org/wiki/Internet_media_type#Naming
/**
* Mime types and associated extensions are stored in the form:
*
* <type> <ext> <ext> <ext>
*
* And some are commented out with a leading `#` because they have no associated extensions.
* This regexp checks whether a single line matches this format, ignoring lines that are just comments.
* We could also just remove all lines that start with `#` if we want to make the JSON files smaller
* and ignore all mime types without associated extensions.
*/
var re = /^(?:# )?([\w-]+\/[\w\+\.-]+)(?:\s+\w+)*$/
text = text.split('\n')
.filter(Boolean)
.forEach(function (line) {
line = line.trim()
if (!line) return
var match = re.exec(line)
if (!match) return
// remove the leading # and <type> and return all the <ext>s
json[match[1]] = line.replace(/^(?:# )?([\w-]+\/[\w\+\.-]+)/, '')
.split(/\s+/)
.filter(Boolean)
})
fs.writeFileSync('lib/' + path.basename(url).split('.')[0] + '.json',
JSON.stringify(json, null, 2) + '\n')
}
co(function* () {
yield [
get('http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types'),
get('https://raw.githubusercontent.com/broofa/node-mime/master/types/node.types')
]
})()
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "0.1.0", "version": "0.1.0",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
......
...@@ -20,5 +20,8 @@ ...@@ -20,5 +20,8 @@
], ],
"text/x-handlebars-template": [ "text/x-handlebars-template": [
"hbs" "hbs"
],
"text/jsx": [
"jsx"
] ]
} }
{ {
"name": "mime-types", "name": "mime-types",
"description": "ultimate mime type utility", "description": "The ultimate javascript content-type utility.",
"version": "1.0.0", "version": "1.0.1",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -26,14 +26,17 @@ ...@@ -26,14 +26,17 @@
"mocha": "1", "mocha": "1",
"should": "3" "should": "3"
}, },
"engines": {
"node": ">= 0.8.0"
},
"scripts": { "scripts": {
"test": "make test" "test": "make test"
}, },
"readme": "# mime-types [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types) [![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [mime](https://github.com/broofa/node-mime) except:\n\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- No fallbacks, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n", "readme": "# mime-types\n[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)\n\nThe ultimate javascript content-type utility.\n\n### Install\n\n```sh\n$ npm install mime-types\n```\n\n#### Similar to [node-mime](https://github.com/broofa/node-mime), except:\n\n- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- Additional mime types are added such as jade and stylus. Feel free to add more!\n- Browser support via Browserify and Component by converting lists to JSON files.\n\nOtherwise, the API is compatible.\n\n### Adding Types\n\nIf you'd like to add additional types,\nsimply create a PR adding the type to `custom.json` and\na reference link to the [sources](SOURCES.md).\n\nDo __NOT__ edit `mime.json` or `node.json`.\nThose are pulled using `build.js`.\nYou should only touch `custom.json`.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### mime.types[extension] = type\n\nA map of content-types by extension.\n\n### mime.extensions[type] = [extensions]\n\nA map of extensions by content-type.\n\n### mime.define(types)\n\nGlobally add definitions.\n`types` must be an object of the form:\n\n```js\n{\n \"<content-type>\": [extensions...],\n \"<content-type>\": [extensions...]\n}\n```\n\nSee the `.json` files in `lib/` for examples.\n\n## License\n\n[MIT](LICENSE)\n",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"bugs": { "bugs": {
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.0", "_id": "mime-types@1.0.1",
"_from": "mime-types@~1.0.0" "_from": "mime-types@~1.0.0"
} }
/**
* Usage: node test.js
*/
var mime = require("..");
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(false, 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.charset('text/plain'));
eq(false, mime.charset(mime.types.js));
eq('UTF-8', mime.charset('application/json'))
eq('UTF-8', mime.charsets.lookup('text/something'));
// eq('fallback', mime.charset('application/octet-stream', 'fallback'));
var assert = require('assert')
var mime = require('..')
var lookup = mime.lookup
var extension = mime.extension
var charset = mime.charset
var contentType = mime.contentType
describe('.lookup()', function () {
it('jade', function () {
assert.equal(lookup('jade'), 'text/jade')
assert.equal(lookup('.jade'), 'text/jade')
assert.equal(lookup('file.jade'), 'text/jade')
assert.equal(lookup('folder/file.jade'), 'text/jade')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
lookup({ noteven: "once" })
lookup(null)
lookup(true)
lookup(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(lookup('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.extension()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
extension({ noteven: "once" })
extension(null)
extension(true)
extension(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(extension('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.charset()', function () {
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
charset({ noteven: "once" })
charset(null)
charset(true)
charset(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(charset('.jalksdjflakjsdjfasdf'), false)
})
})
describe('.contentType()', function () {
it('html', function () {
assert.equal(contentType('html'), 'text/html; charset=utf-8')
})
it('text/html; charset=ascii', function () {
assert.equal(contentType('text/html; charset=ascii'), 'text/html; charset=ascii')
})
it('json', function () {
assert.equal(contentType('json'), 'application/json; charset=utf-8')
})
it('application/json', function () {
assert.equal(contentType('application/json'), 'application/json; charset=utf-8')
})
it('jade', function () {
assert.equal(contentType('jade'), 'text/jade; charset=utf-8')
})
it('should not error on non-string types', function () {
assert.doesNotThrow(function () {
contentType({ noteven: "once" })
contentType(null)
contentType(true)
contentType(Infinity)
})
})
it('should return false for unknown types', function () {
assert.equal(contentType('.jalksdjflakjsdjfasdf'), false)
})
})
...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) { ...@@ -50,6 +50,7 @@ function getLanguagePriority(language, accepted) {
function specify(language, spec) { function specify(language, spec) {
var p = parseLanguage(language) var p = parseLanguage(language)
if (!p) return null;
var s = 0; var s = 0;
if(spec.full === p.full){ if(spec.full === p.full){
s |= 4; s |= 4;
......
...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) { ...@@ -57,6 +57,11 @@ function getMediaTypePriority(type, accepted) {
function specify(type, spec) { function specify(type, spec) {
var p = parseMediaType(type); var p = parseMediaType(type);
var s = 0; var s = 0;
if (!p) {
return null;
}
if(spec.type == p.type) { if(spec.type == p.type) {
s |= 4 s |= 4
} else if(spec.type != '*') { } else if(spec.type != '*') {
......
{ {
"name": "negotiator", "name": "negotiator",
"description": "HTTP content negotiation", "description": "HTTP content negotiation",
"version": "0.4.6", "version": "0.4.7",
"author": { "author": {
"name": "Federico Romero", "name": "Federico Romero",
"email": "federico.romero@outboxlabs.com" "email": "federico.romero@outboxlabs.com"
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
"url": "https://github.com/federomero/negotiator/issues" "url": "https://github.com/federomero/negotiator/issues"
}, },
"dependencies": {}, "dependencies": {},
"_id": "negotiator@0.4.6", "_id": "negotiator@0.4.7",
"_from": "negotiator@0.4.6" "dist": {
"shasum": "8273ad98ad1c14fed21daa9a404fb6a102d47305"
},
"_from": "negotiator@0.4.7",
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz"
} }
{ {
"name": "accepts", "name": "accepts",
"description": "Higher-level content negotiation", "description": "Higher-level content negotiation",
"version": "1.0.5", "version": "1.0.6",
"author": { "author": {
"name": "Jonathan Ong", "name": "Jonathan Ong",
"email": "me@jongleberry.com", "email": "me@jongleberry.com",
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
}, },
"dependencies": { "dependencies": {
"mime-types": "~1.0.0", "mime-types": "~1.0.0",
"negotiator": "0.4.6" "negotiator": "0.4.7"
}, },
"devDependencies": { "devDependencies": {
"istanbul": "0.2.10", "istanbul": "0.2.11",
"mocha": "*", "mocha": "*",
"should": "*" "should": "*"
}, },
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
"bugs": { "bugs": {
"url": "https://github.com/expressjs/accepts/issues" "url": "https://github.com/expressjs/accepts/issues"
}, },
"_id": "accepts@1.0.5", "_id": "accepts@1.0.6",
"_from": "accepts@~1.0.5" "dist": {
"shasum": "fc9be3e5812513c8e758ea54d87f07275a5529d5"
},
"_from": "accepts@~1.0.5",
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.0.6.tgz"
} }
...@@ -21,9 +21,5 @@ ...@@ -21,9 +21,5 @@
"url": "https://github.com/visionmedia/batch/issues" "url": "https://github.com/visionmedia/batch/issues"
}, },
"_id": "batch@0.5.1", "_id": "batch@0.5.1",
"dist": { "_from": "batch@0.5.1"
"shasum": "b594d6bf7ff8e219057f32834e02265882d2966e"
},
"_from": "batch@0.5.1",
"_resolved": "https://registry.npmjs.org/batch/-/batch-0.5.1.tgz"
} }
...@@ -35,9 +35,5 @@ ...@@ -35,9 +35,5 @@
"url": "https://github.com/expressjs/serve-index/issues" "url": "https://github.com/expressjs/serve-index/issues"
}, },
"_id": "serve-index@1.1.4", "_id": "serve-index@1.1.4",
"dist": { "_from": "serve-index@*"
"shasum": "14577ccdd9d566e3868c6538a696c482be6840b4"
},
"_from": "serve-index@*",
"_resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.1.4.tgz"
} }
1.3.0 / 2014-06-28
==================
* Add `setHeaders` option
* Include HTML link in redirect response
* deps: send@0.5.0
- Accept string for `maxAge` (converted by `ms`)
1.2.3 / 2014-06-11 1.2.3 / 2014-06-11
================== ==================
......
...@@ -28,8 +28,9 @@ Options: ...@@ -28,8 +28,9 @@ Options:
- `hidden` Allow transfer of hidden files. defaults to `false` - `hidden` Allow transfer of hidden files. defaults to `false`
- `index` Default file name, defaults to `'index.html'` - `index` Default file name, defaults to `'index.html'`
- `maxAge` Browser cache maxAge in milliseconds. defaults to `0` - `maxAge` Browser cache maxAge in milliseconds. This can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) module. defaults to `0`
- `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to `true` - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to `true`
- `setHeaders` Function to set custom headers on response.
## Examples ## Examples
...@@ -65,6 +66,25 @@ app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']})) ...@@ -65,6 +66,25 @@ app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
app.listen(3000) app.listen(3000)
``` ```
### Serve all files as downloads
```js
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic('public/ftp', {
'index': false,
'setHeaders': setHeaders
}))
app.listen(3000)
function setHeaders(res, path) {
res.attachment(path)
}
```
## License ## License
The MIT License (MIT) The MIT License (MIT)
......
...@@ -59,6 +59,14 @@ exports = module.exports = function(root, options){ ...@@ -59,6 +59,14 @@ exports = module.exports = function(root, options){
// default redirect // default redirect
var redirect = false !== options.redirect; var redirect = false !== options.redirect;
// headers listener
var setHeaders = options.setHeaders
delete options.setHeaders
if (setHeaders && typeof setHeaders !== 'function') {
throw new TypeError('option setHeaders must be function')
}
// setup options for send // setup options for send
options.maxage = options.maxage || options.maxAge || 0; options.maxage = options.maxage || options.maxAge || 0;
options.root = root; options.root = root;
...@@ -69,29 +77,43 @@ exports = module.exports = function(root, options){ ...@@ -69,29 +77,43 @@ exports = module.exports = function(root, options){
var originalUrl = url.parse(req.originalUrl || req.url); var originalUrl = url.parse(req.originalUrl || req.url);
var path = parseurl(req).pathname; var path = parseurl(req).pathname;
if (path == '/' && originalUrl.pathname[originalUrl.pathname.length - 1] != '/') { if (path === '/' && originalUrl.pathname[originalUrl.pathname.length - 1] !== '/') {
return directory(); // make sure redirect occurs at mount
path = ''
} }
function directory() { // create send stream
if (!redirect) return next(); var stream = send(req, path, opts)
var target;
originalUrl.pathname += '/'; if (redirect) {
target = url.format(originalUrl); // redirect relative to originalUrl
res.statusCode = 303; stream.on('directory', function redirect() {
res.setHeader('Location', target); originalUrl.pathname += '/'
res.end('Redirecting to ' + escapeHtml(target));
var target = url.format(originalUrl)
res.statusCode = 303
res.setHeader('Content-Type', 'text/html; charset=utf-8')
res.setHeader('Location', target)
res.end('Redirecting to <a href="' + escapeHtml(target) + '">' + escapeHtml(target) + '</a>\n')
})
} else {
// forward to next middleware on directory
stream.on('directory', next)
} }
function error(err) { // add headers listener
if (404 == err.status) return next(); if (setHeaders) {
next(err); stream.on('headers', setHeaders)
} }
send(req, path, opts) // forward non-404 errors
.on('error', error) stream.on('error', function error(err) {
.on('directory', directory) next(err.status === 404 ? null : err)
.pipe(res); })
// pipe
stream.pipe(res)
}; };
}; };
......
0.5.0 / 2014-06-28
==================
* Accept string for `maxAge` (converted by `ms`)
* Add `headers` event
* Include link in default redirect response
* Use `EventEmitter.listenerCount` to count listeners
0.4.3 / 2014-06-11 0.4.3 / 2014-06-11
================== ==================
......
...@@ -38,6 +38,12 @@ var app = http.createServer(function(req, res){ ...@@ -38,6 +38,12 @@ var app = http.createServer(function(req, res){
res.end(err.message); res.end(err.message);
} }
// your custom headers
function headers(res, path, stat) {
// serve all files for download
res.setHeader('Content-Disposition', 'attachment');
}
// your custom directory handling logic: // your custom directory handling logic:
function redirect() { function redirect() {
res.statusCode = 301; res.statusCode = 301;
...@@ -50,6 +56,7 @@ var app = http.createServer(function(req, res){ ...@@ -50,6 +56,7 @@ var app = http.createServer(function(req, res){
send(req, url.parse(req.url).pathname, {root: '/www/example.com/public'}) send(req, url.parse(req.url).pathname, {root: '/www/example.com/public'})
.on('error', error) .on('error', error)
.on('directory', redirect) .on('directory', redirect)
.on('headers', headers)
.pipe(res); .pipe(res);
}).listen(3000); }).listen(3000);
``` ```
...@@ -75,6 +82,8 @@ var app = http.createServer(function(req, res){ ...@@ -75,6 +82,8 @@ var app = http.createServer(function(req, res){
#### maxage #### maxage
Provide a max-age in milliseconds for http caching, defaults to 0. Provide a max-age in milliseconds for http caching, defaults to 0.
This can also be a string accepted by the
[ms](https://www.npmjs.org/package/ms#readme) module.
#### root #### root
...@@ -85,6 +94,7 @@ var app = http.createServer(function(req, res){ ...@@ -85,6 +94,7 @@ var app = http.createServer(function(req, res){
- `error` an error occurred `(err)` - `error` an error occurred `(err)`
- `directory` a directory was requested - `directory` a directory was requested
- `file` a file was requested `(path, stat)` - `file` a file was requested `(path, stat)`
- `headers` the headers are about to be set on a file `(res, path, stat)`
- `stream` file streaming has started `(stream)` - `stream` file streaming has started `(stream)`
- `end` streaming has completed - `end` streaming has completed
...@@ -105,6 +115,8 @@ var app = http.createServer(function(req, res){ ...@@ -105,6 +115,8 @@ var app = http.createServer(function(req, res){
### .maxage(ms) ### .maxage(ms)
Provide a max-age in milliseconds for http caching, defaults to 0. Provide a max-age in milliseconds for http caching, defaults to 0.
This can also be a string accepted by the
[ms](https://www.npmjs.org/package/ms#readme) module.
### .hidden(bool) ### .hidden(bool)
......
...@@ -17,6 +17,8 @@ var escapeHtml = require('escape-html') ...@@ -17,6 +17,8 @@ var escapeHtml = require('escape-html')
, normalize = path.normalize , normalize = path.normalize
, join = path.join , join = path.join
, utils = require('./utils'); , utils = require('./utils');
var EventEmitter = require('events').EventEmitter;
var ms = require('ms');
var upPathRegexp = /(?:^|[\\\/])\.\.(?:[\\\/]|$)/; var upPathRegexp = /(?:^|[\\\/])\.\.(?:[\\\/]|$)/;
...@@ -32,6 +34,14 @@ exports = module.exports = send; ...@@ -32,6 +34,14 @@ exports = module.exports = send;
exports.mime = mime; exports.mime = mime;
/**
* Shim EventEmitter.listenerCount for node.js < 0.10
*/
/* istanbul ignore next */
var listenerCount = EventEmitter.listenerCount
|| function(emitter, type){ return emitter.listeners(type).length; };
/** /**
* Return a `SendStream` for `req` and `path`. * Return a `SendStream` for `req` and `path`.
* *
...@@ -143,19 +153,21 @@ SendStream.prototype.from = function(path){ ...@@ -143,19 +153,21 @@ SendStream.prototype.from = function(path){
}; };
/** /**
* Set max-age to `ms`. * Set max-age to `maxAge`.
* *
* @param {Number} ms * @param {Number} maxAge
* @return {SendStream} * @return {SendStream}
* @api public * @api public
*/ */
SendStream.prototype.maxage = function(ms){ SendStream.prototype.maxage = function maxage(maxAge){
ms = Number(ms); maxAge = typeof maxAge === 'string'
if (isNaN(ms)) ms = 0; ? ms(maxAge)
if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000; : Number(maxAge);
debug('max-age %d', ms); if (isNaN(maxAge)) maxAge = 0;
this._maxage = ms; if (Infinity == maxAge) maxAge = 60 * 60 * 24 * 365 * 1000;
debug('max-age %d', maxAge);
this._maxage = maxAge;
return this; return this;
}; };
...@@ -174,7 +186,7 @@ SendStream.prototype.error = function(status, err){ ...@@ -174,7 +186,7 @@ SendStream.prototype.error = function(status, err){
err.status = status; err.status = status;
// emit if listeners instead of responding // emit if listeners instead of responding
if (this.listeners('error').length) { if (listenerCount(this, 'error') !== 0) {
return this.emit('error', err); return this.emit('error', err);
} }
...@@ -333,13 +345,17 @@ SendStream.prototype.isRangeFresh = function isRangeFresh(){ ...@@ -333,13 +345,17 @@ SendStream.prototype.isRangeFresh = function isRangeFresh(){
*/ */
SendStream.prototype.redirect = function(path){ SendStream.prototype.redirect = function(path){
if (this.listeners('directory').length) return this.emit('directory'); if (listenerCount(this, 'directory') !== 0) {
return this.emit('directory');
}
if (this.hasTrailingSlash()) return this.error(403); if (this.hasTrailingSlash()) return this.error(403);
var res = this.res; var res = this.res;
path += '/'; path += '/';
res.statusCode = 301; res.statusCode = 301;
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.setHeader('Location', path); res.setHeader('Location', path);
res.end('Redirecting to ' + escapeHtml(path)); res.end('Redirecting to <a href="' + escapeHtml(path) + '">' + escapeHtml(path) + '</a>\n');
}; };
/** /**
...@@ -592,6 +608,9 @@ SendStream.prototype.type = function(path){ ...@@ -592,6 +608,9 @@ SendStream.prototype.type = function(path){
SendStream.prototype.setHeader = function setHeader(path, stat){ SendStream.prototype.setHeader = function setHeader(path, stat){
var res = this.res; var res = this.res;
this.emit('headers', res, path, stat);
if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString());
if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + Math.floor(this._maxage / 1000)); if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + Math.floor(this._maxage / 1000));
......
...@@ -47,5 +47,6 @@ ...@@ -47,5 +47,6 @@
"shasum": "a1c1da1278c90866cc063eff49db9f0a8a0a211e" "shasum": "a1c1da1278c90866cc063eff49db9f0a8a0a211e"
}, },
"_from": "debug@1.0.2", "_from": "debug@1.0.2",
"_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz" "_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz",
"scripts": {}
} }
...@@ -29,5 +29,6 @@ ...@@ -29,5 +29,6 @@
"url": "https://github.com/visionmedia/node-fresh/issues" "url": "https://github.com/visionmedia/node-fresh/issues"
}, },
"_id": "fresh@0.2.2", "_id": "fresh@0.2.2",
"_from": "fresh@0.2.2" "_from": "fresh@0.2.2",
"scripts": {}
} }
...@@ -23,5 +23,6 @@ ...@@ -23,5 +23,6 @@
"url": "https://github.com/guille/ms.js/issues" "url": "https://github.com/guille/ms.js/issues"
}, },
"_id": "ms@0.6.2", "_id": "ms@0.6.2",
"_from": "ms@0.6.2" "_from": "ms@0.6.2",
"scripts": {}
} }
...@@ -29,5 +29,6 @@ ...@@ -29,5 +29,6 @@
"url": "https://github.com/visionmedia/node-range-parser/issues" "url": "https://github.com/visionmedia/node-range-parser/issues"
}, },
"_id": "range-parser@1.0.0", "_id": "range-parser@1.0.0",
"_from": "range-parser@~1.0.0" "_from": "range-parser@~1.0.0",
"scripts": {}
} }
{ {
"name": "serve-static", "name": "serve-static",
"description": "Serve static files", "description": "Serve static files",
"version": "1.2.3", "version": "1.3.0",
"author": { "author": {
"name": "Douglas Christopher Wilson", "name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com" "email": "doug@somethingdoug.com"
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
"dependencies": { "dependencies": {
"escape-html": "1.0.1", "escape-html": "1.0.1",
"parseurl": "1.0.1", "parseurl": "1.0.1",
"send": "0.4.3" "send": "0.5.0"
}, },
"devDependencies": { "devDependencies": {
"istanbul": "0.2.10", "istanbul": "0.2.13",
"mocha": "~1.20.0", "mocha": "~1.20.0",
"should": "~4.0.0", "should": "~4.0.0",
"supertest": "~0.13.0" "supertest": "~0.13.0"
...@@ -30,11 +30,15 @@ ...@@ -30,11 +30,15 @@
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/" "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/"
}, },
"readme": "# serve-static\n\n[![NPM version](https://badge.fury.io/js/serve-static.svg)](http://badge.fury.io/js/serve-static)\n[![Build Status](https://travis-ci.org/expressjs/serve-static.svg?branch=master)](https://travis-ci.org/expressjs/serve-static)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/serve-static.svg?branch=master)](https://coveralls.io/r/expressjs/serve-static)\n\nPreviously `connect.static()`.\n\n## Install\n\n```sh\n$ npm install serve-static\n```\n\n## API\n\n```js\nvar serveStatic = require('serve-static')\n```\n\n### serveStatic(root, options)\n\nCreate a new middleware function to serve files from within a given root\ndirectory. The file to serve will be determined by combining `req.url`\nwith the provided root directory.\n\nOptions:\n\n- `hidden` Allow transfer of hidden files. defaults to `false`\n- `index` Default file name, defaults to `'index.html'`\n- `maxAge` Browser cache maxAge in milliseconds. defaults to `0`\n- `redirect` Redirect to trailing \"/\" when the pathname is a dir. defaults to `true`\n\n## Examples\n\n### Serve files with vanilla node.js http server\n\n```js\nvar finalhandler = require('finalhandler')\nvar http = require('http')\nvar serveStatic = require('serve-static')\n\n// Serve up public/ftp folder\nvar serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})\n\n// Create server\nvar server = http.createServer(function(req, res){\n var done = finalhandler(req, res)\n serve(req, res, done)\n})\n\n// Listen\nserver.listen(3000)\n```\n\n### Serve all files from ftp folder\n\n```js\nvar connect = require('connect')\nvar serveStatic = require('serve-static')\n\nvar app = connect()\n\napp.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))\napp.listen(3000)\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", "readme": "# serve-static\n\n[![NPM version](https://badge.fury.io/js/serve-static.svg)](http://badge.fury.io/js/serve-static)\n[![Build Status](https://travis-ci.org/expressjs/serve-static.svg?branch=master)](https://travis-ci.org/expressjs/serve-static)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/serve-static.svg?branch=master)](https://coveralls.io/r/expressjs/serve-static)\n\nPreviously `connect.static()`.\n\n## Install\n\n```sh\n$ npm install serve-static\n```\n\n## API\n\n```js\nvar serveStatic = require('serve-static')\n```\n\n### serveStatic(root, options)\n\nCreate a new middleware function to serve files from within a given root\ndirectory. The file to serve will be determined by combining `req.url`\nwith the provided root directory.\n\nOptions:\n\n- `hidden` Allow transfer of hidden files. defaults to `false`\n- `index` Default file name, defaults to `'index.html'`\n- `maxAge` Browser cache maxAge in milliseconds. This can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) module. defaults to `0`\n- `redirect` Redirect to trailing \"/\" when the pathname is a dir. defaults to `true`\n- `setHeaders` Function to set custom headers on response.\n\n## Examples\n\n### Serve files with vanilla node.js http server\n\n```js\nvar finalhandler = require('finalhandler')\nvar http = require('http')\nvar serveStatic = require('serve-static')\n\n// Serve up public/ftp folder\nvar serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})\n\n// Create server\nvar server = http.createServer(function(req, res){\n var done = finalhandler(req, res)\n serve(req, res, done)\n})\n\n// Listen\nserver.listen(3000)\n```\n\n### Serve all files from ftp folder\n\n```js\nvar connect = require('connect')\nvar serveStatic = require('serve-static')\n\nvar app = connect()\n\napp.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))\napp.listen(3000)\n```\n\n### Serve all files as downloads\n\n```js\nvar express = require('express')\nvar serveStatic = require('serve-static')\n\nvar app = express()\n\napp.use(serveStatic('public/ftp', {\n 'index': false,\n 'setHeaders': setHeaders\n}))\napp.listen(3000)\n\nfunction setHeaders(res, path) {\n res.attachment(path)\n}\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
"readmeFilename": "Readme.md", "readmeFilename": "Readme.md",
"bugs": { "bugs": {
"url": "https://github.com/expressjs/serve-static/issues" "url": "https://github.com/expressjs/serve-static/issues"
}, },
"_id": "serve-static@1.2.3", "_id": "serve-static@1.3.0",
"_from": "serve-static@*" "dist": {
"shasum": "e35776221565df27ce3895a0d872ec5177647cc1"
},
"_from": "serve-static@*",
"_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.3.0.tgz"
} }
...@@ -41,5 +41,9 @@ ...@@ -41,5 +41,9 @@
"url": "https://github.com/visionmedia/debug/issues" "url": "https://github.com/visionmedia/debug/issues"
}, },
"_id": "debug@0.7.4", "_id": "debug@0.7.4",
"_from": "debug@0.7.4" "dist": {
"shasum": "6d61ff0bcdda31e2135e2cc0d7d6f0aa80b09c19"
},
"_from": "debug@0.7.4",
"_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz"
} }
...@@ -22,5 +22,9 @@ ...@@ -22,5 +22,9 @@
"readme": "\n# debug\n\n tiny node.js debugging utility.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Example\n\n This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:\n\n```js\nvar debug;\nif (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {\n debug = function(x) {\n var prefix = process.pid + ',' +\n (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');\n console.error(prefix, x);\n };\n} else {\n debug = function() { };\n}\n```\n\n This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "readme": "\n# debug\n\n tiny node.js debugging utility.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Example\n\n This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:\n\n```js\nvar debug;\nif (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {\n debug = function(x) {\n var prefix = process.pid + ',' +\n (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');\n console.error(prefix, x);\n };\n} else {\n debug = function() { };\n}\n```\n\n This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"readmeFilename": "Readme.md", "readmeFilename": "Readme.md",
"_id": "debug@0.6.0", "_id": "debug@0.6.0",
"_from": "debug@0.6.0" "dist": {
"shasum": "f56cb9d82bc76b3df607b6c27936d28e7c939de5"
},
"_from": "debug@0.6.0",
"_resolved": "https://registry.npmjs.org/debug/-/debug-0.6.0.tgz"
} }
...@@ -35,5 +35,9 @@ ...@@ -35,5 +35,9 @@
"url": "https://github.com/LearnBoost/engine.io-parser/issues" "url": "https://github.com/LearnBoost/engine.io-parser/issues"
}, },
"_id": "engine.io-parser@1.0.6", "_id": "engine.io-parser@1.0.6",
"_from": "engine.io-parser@1.0.6" "dist": {
"shasum": "076906199bcf2195521947dd6e831c5bfcbfc5d5"
},
"_from": "engine.io-parser@1.0.6",
"_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.0.6.tgz"
} }
...@@ -56,5 +56,9 @@ ...@@ -56,5 +56,9 @@
"url": "https://github.com/einaros/ws/issues" "url": "https://github.com/einaros/ws/issues"
}, },
"_id": "ws@0.4.31", "_id": "ws@0.4.31",
"_from": "ws@0.4.31" "dist": {
"shasum": "fed17bd81b4cc99cb79b75ffd49953fd3e7bf0d6"
},
"_from": "ws@0.4.31",
"_resolved": "https://registry.npmjs.org/ws/-/ws-0.4.31.tgz"
} }
...@@ -52,5 +52,9 @@ ...@@ -52,5 +52,9 @@
"url": "https://github.com/LearnBoost/engine.io/issues" "url": "https://github.com/LearnBoost/engine.io/issues"
}, },
"_id": "engine.io@1.3.1", "_id": "engine.io@1.3.1",
"_from": "engine.io@1.3.1" "dist": {
"shasum": "889c501bab3765ede9fd6681e20e10557db72ebf"
},
"_from": "engine.io@1.3.1",
"_resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.3.1.tgz"
} }
...@@ -32,5 +32,9 @@ ...@@ -32,5 +32,9 @@
"url": "https://github.com/juliangruber/isarray/issues" "url": "https://github.com/juliangruber/isarray/issues"
}, },
"_id": "isarray@0.0.1", "_id": "isarray@0.0.1",
"_from": "isarray@0.0.1" "dist": {
"shasum": "dc2d43f65e32bd485997e422c73ade69f488882f"
},
"_from": "isarray@0.0.1",
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
} }
...@@ -16,5 +16,9 @@ ...@@ -16,5 +16,9 @@
"readme": "has-binarydata.js\n=================\n\nSimple module to test if an object contains binary data\n", "readme": "has-binarydata.js\n=================\n\nSimple module to test if an object contains binary data\n",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"_id": "has-binary-data@0.1.1", "_id": "has-binary-data@0.1.1",
"_from": "has-binary-data@0.1.1" "dist": {
"shasum": "394a850da71bf91a8bd02797ccec161946eeaf93"
},
"_from": "has-binary-data@0.1.1",
"_resolved": "https://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.1.tgz"
} }
...@@ -32,5 +32,9 @@ ...@@ -32,5 +32,9 @@
"url": "https://github.com/juliangruber/isarray/issues" "url": "https://github.com/juliangruber/isarray/issues"
}, },
"_id": "isarray@0.0.1", "_id": "isarray@0.0.1",
"_from": "isarray@0.0.1" "dist": {
"shasum": "dc2d43f65e32bd485997e422c73ade69f488882f"
},
"_from": "isarray@0.0.1",
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
} }
...@@ -25,5 +25,9 @@ ...@@ -25,5 +25,9 @@
"url": "https://github.com/component/emitter/issues" "url": "https://github.com/component/emitter/issues"
}, },
"_id": "component-emitter@1.1.2", "_id": "component-emitter@1.1.2",
"_from": "component-emitter@1.1.2" "dist": {
"shasum": "8a6787a888a95dd6cfd203dbd1b752a68e2d6b50"
},
"_from": "component-emitter@1.1.2",
"_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz"
} }
...@@ -35,5 +35,9 @@ ...@@ -35,5 +35,9 @@
"url": "https://github.com/LearnBoost/engine.io-parser/issues" "url": "https://github.com/LearnBoost/engine.io-parser/issues"
}, },
"_id": "engine.io-parser@1.0.6", "_id": "engine.io-parser@1.0.6",
"_from": "engine.io-parser@1.0.6" "dist": {
"shasum": "076906199bcf2195521947dd6e831c5bfcbfc5d5"
},
"_from": "engine.io-parser@1.0.6",
"_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.0.6.tgz"
} }
...@@ -56,5 +56,9 @@ ...@@ -56,5 +56,9 @@
"url": "https://github.com/einaros/ws/issues" "url": "https://github.com/einaros/ws/issues"
}, },
"_id": "ws@0.4.31", "_id": "ws@0.4.31",
"_from": "ws@0.4.31" "dist": {
"shasum": "fed17bd81b4cc99cb79b75ffd49953fd3e7bf0d6"
},
"_from": "ws@0.4.31",
"_resolved": "https://registry.npmjs.org/ws/-/ws-0.4.31.tgz"
} }
...@@ -16,6 +16,5 @@ ...@@ -16,6 +16,5 @@
"readme": "\n# indexOf\n\n Lame indexOf thing, thanks microsoft\n\n## Example\n\n```js\nvar index = require('indexof');\nindex(arr, obj);\n```\n\n## License\n\n MIT", "readme": "\n# indexOf\n\n Lame indexOf thing, thanks microsoft\n\n## Example\n\n```js\nvar index = require('indexof');\nindex(arr, obj);\n```\n\n## License\n\n MIT",
"readmeFilename": "Readme.md", "readmeFilename": "Readme.md",
"_id": "indexof@0.0.1", "_id": "indexof@0.0.1",
"_from": "indexof@0.0.1", "_from": "indexof@0.0.1"
"scripts": {}
} }
...@@ -15,5 +15,9 @@ ...@@ -15,5 +15,9 @@
}, },
"readme": "ERROR: No README data found!", "readme": "ERROR: No README data found!",
"_id": "parseuri@0.0.2", "_id": "parseuri@0.0.2",
"_from": "parseuri@0.0.2" "dist": {
"shasum": "5ee9ebd7cf0ddec60c4c0987b612e880c8ba7b07"
},
"_from": "parseuri@0.0.2",
"_resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.2.tgz"
} }
...@@ -16,5 +16,6 @@ ...@@ -16,5 +16,6 @@
"readme": "\n# indexOf\n\n Lame indexOf thing, thanks microsoft\n\n## Example\n\n```js\nvar index = require('indexof');\nindex(arr, obj);\n```\n\n## License\n\n MIT", "readme": "\n# indexOf\n\n Lame indexOf thing, thanks microsoft\n\n## Example\n\n```js\nvar index = require('indexof');\nindex(arr, obj);\n```\n\n## License\n\n MIT",
"readmeFilename": "Readme.md", "readmeFilename": "Readme.md",
"_id": "indexof@0.0.1", "_id": "indexof@0.0.1",
"_from": "indexof@0.0.1" "_from": "indexof@0.0.1",
"scripts": {}
} }
...@@ -32,5 +32,9 @@ ...@@ -32,5 +32,9 @@
"url": "https://github.com/juliangruber/isarray/issues" "url": "https://github.com/juliangruber/isarray/issues"
}, },
"_id": "isarray@0.0.1", "_id": "isarray@0.0.1",
"_from": "isarray@0.0.1" "dist": {
"shasum": "dc2d43f65e32bd485997e422c73ade69f488882f"
},
"_from": "isarray@0.0.1",
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment