Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: send @ 0.16.2 .. 0.17.0

HISTORY.md

@@ -1,3 +1,31 @@
+0.17.0 / 2019-05-03
+===================
+
+ * deps: http-errors@~1.7.2
+ - Set constructor name when possible
+ - Use `toidentifier` module to make class names
+ - deps: depd@~1.1.2
+ - deps: setprototypeof@1.1.1
+ - deps: statuses@'>= 1.5.0 < 2'
+ * deps: mime@1.6.0
+ - Add extensions for JPEG-2000 images
+ - Add new `font/*` types from IANA
+ - Add WASM mapping
+ - Update `.bdoc` to `application/bdoc`
+ - Update `.bmp` to `image/bmp`
+ - Update `.m4a` to `audio/mp4`
+ - Update `.rtf` to `application/rtf`
+ - Update `.wav` to `audio/wav`
+ - Update `.xml` to `application/xml`
+ - Update generic extensions to `application/octet-stream`:
+ `.deb`, `.dll`, `.dmg`, `.exe`, `.iso`, `.msi`
+ - Use mime-score module to resolve extension conflicts
+ * deps: ms@2.1.1
+ - Add `week`/`w` support
+ - Fix negative number handling
+ * deps: statuses@~1.5.0
+ * perf: remove redundant `path.normalize` call
+
0.16.2 / 2018-02-07
===================

index.js

@@ -546,7 +546,6 @@
// join / normalize from optional root dir
path = normalize(join(root, path))
- root = normalize(root + sep)
} else {
// ".." is malicious without "root"
if (UP_PATH_REGEXP.test(path)) {
@@ -669,7 +668,7 @@
// 416 Requested Range Not Satisfiable
return this.error(416, {
- headers: {'Content-Range': res.getHeader('Content-Range')}
+ headers: { 'Content-Range': res.getHeader('Content-Range') }
})
}

package.json

@@ -1,7 +1,7 @@
{
"name": "send",
"description": "Better streaming static file server with Range and conditional-GET support",
- "version": "0.16.2",
+ "version": "0.17.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
@@ -23,25 +23,25 @@
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
- "http-errors": "~1.6.2",
- "mime": "1.4.1",
- "ms": "2.0.0",
+ "http-errors": "~1.7.2",
+ "mime": "1.6.0",
+ "ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.0",
- "statuses": "~1.4.0"
+ "statuses": "~1.5.0"
},
"devDependencies": {
"after": "0.8.2",
- "eslint": "3.19.0",
- "eslint-config-standard": "10.2.1",
- "eslint-plugin-import": "2.8.0",
- "eslint-plugin-markdown": "1.0.0-beta.6",
- "eslint-plugin-node": "5.2.1",
- "eslint-plugin-promise": "3.6.0",
- "eslint-plugin-standard": "3.0.1",
+ "eslint": "5.16.0",
+ "eslint-config-standard": "12.0.0",
+ "eslint-plugin-import": "2.17.2",
+ "eslint-plugin-markdown": "1.0.0",
+ "eslint-plugin-node": "8.0.1",
+ "eslint-plugin-promise": "4.1.1",
+ "eslint-plugin-standard": "4.0.0",
"istanbul": "0.4.5",
- "mocha": "2.5.3",
- "supertest": "1.1.0"
+ "mocha": "6.1.4",
+ "supertest": "4.0.2"
},
"files": [
"HISTORY.md",

README.md

@@ -1,7 +1,7 @@
# send
-[![NPM Version][npm-image]][npm-url]
-[![NPM Downloads][downloads-image]][downloads-url]
+[![NPM Version][npm-version-image]][npm-url]
+[![NPM Downloads][npm-downloads-image]][npm-url]
[![Linux Build][travis-image]][travis-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Test Coverage][coveralls-image]][coveralls-url]
@@ -174,7 +174,27 @@
## Examples
-### Small example
+### Serve a specific file
+
+This simple example will send a specific file to all requests.
+
+```js
+var http = require('http')
+var send = require('send')
+
+var server = http.createServer(function onRequest (req, res) {
+ send(req, '/path/to/index.html')
+ .pipe(res)
+})
+
+server.listen(3000)
+```
+
+### Serve all files from a directory
+
+This simple example will just serve up all the files in a
+given directory as the top-level. For example, a request
+`GET /foo.txt` will send back `/www/public/foo.txt`.
```js
var http = require('http')
@@ -182,7 +202,8 @@
var send = require('send')
var server = http.createServer(function onRequest (req, res) {
- send(req, parseUrl(req).pathname).pipe(res)
+ send(req, parseUrl(req).pathname, { root: '/www/public' })
+ .pipe(res)
})
server.listen(3000)
@@ -204,7 +225,8 @@
})
var server = http.createServer(function onRequest (req, res) {
- send(req, parseUrl(req).pathname).pipe(res)
+ send(req, parseUrl(req).pathname, { root: '/www/public' })
+ .pipe(res)
})
server.listen(3000)
@@ -224,7 +246,7 @@
// Transfer arbitrary files from within /www/example.com/public/*
// with a custom handler for directory listing
var server = http.createServer(function onRequest (req, res) {
- send(req, parseUrl(req).pathname, {index: false, root: '/www/example.com/public'})
+ send(req, parseUrl(req).pathname, { index: false, root: '/www/public' })
.once('directory', directory)
.pipe(res)
})
@@ -280,7 +302,7 @@
// transfer arbitrary files from within
// /www/example.com/public/*
- send(req, parseUrl(req).pathname, {root: '/www/example.com/public'})
+ send(req, parseUrl(req).pathname, { root: '/www/public' })
.on('error', error)
.on('directory', redirect)
.on('headers', headers)
@@ -294,13 +316,14 @@
[MIT](LICENSE)
-[npm-image]: https://img.shields.io/npm/v/send.svg
-[npm-url]: https://npmjs.org/package/send
-[travis-image]: https://img.shields.io/travis/pillarjs/send/master.svg?label=linux
-[travis-url]: https://travis-ci.org/pillarjs/send
-[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/send/master.svg?label=windows
+[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send
-[coveralls-image]: https://img.shields.io/coveralls/pillarjs/send/master.svg
+[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
-[downloads-image]: https://img.shields.io/npm/dm/send.svg
-[downloads-url]: https://npmjs.org/package/send
+[node-image]: https://badgen.net/npm/node/send
+[node-url]: https://nodejs.org/en/download/
+[npm-downloads-image]: https://badgen.net/npm/dm/send
+[npm-url]: https://npmjs.org/package/send
+[npm-version-image]: https://badgen.net/npm/v/send
+[travis-image]: https://badgen.net/travis/pillarjs/send/master?label=linux
+[travis-url]: https://travis-ci.org/pillarjs/send