first commit
This commit is contained in:
526
node_modules/send/HISTORY.md
generated
vendored
Normal file
526
node_modules/send/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,526 @@
|
||||
0.19.0 / 2024-09-10
|
||||
===================
|
||||
|
||||
* Remove link renderization in html while redirecting
|
||||
|
||||
0.18.0 / 2022-03-23
|
||||
===================
|
||||
|
||||
* Fix emitted 416 error missing headers property
|
||||
* Limit the headers removed for 304 response
|
||||
* deps: depd@2.0.0
|
||||
- Replace internal `eval` usage with `Function` constructor
|
||||
- Use instance methods on `process` to check for listeners
|
||||
* deps: destroy@1.2.0
|
||||
* deps: http-errors@2.0.0
|
||||
- deps: depd@2.0.0
|
||||
- deps: statuses@2.0.1
|
||||
* deps: on-finished@2.4.1
|
||||
* deps: statuses@2.0.1
|
||||
|
||||
0.17.2 / 2021-12-11
|
||||
===================
|
||||
|
||||
* pref: ignore empty http tokens
|
||||
* deps: http-errors@1.8.1
|
||||
- deps: inherits@2.0.4
|
||||
- deps: toidentifier@1.0.1
|
||||
- deps: setprototypeof@1.2.0
|
||||
* deps: ms@2.1.3
|
||||
|
||||
0.17.1 / 2019-05-10
|
||||
===================
|
||||
|
||||
* Set stricter CSP header in redirect & error responses
|
||||
* deps: range-parser@~1.2.1
|
||||
|
||||
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
|
||||
===================
|
||||
|
||||
* Fix incorrect end tag in default error & redirects
|
||||
* deps: depd@~1.1.2
|
||||
- perf: remove argument reassignment
|
||||
* deps: encodeurl@~1.0.2
|
||||
- Fix encoding `%` as last character
|
||||
* deps: statuses@~1.4.0
|
||||
|
||||
0.16.1 / 2017-09-29
|
||||
===================
|
||||
|
||||
* Fix regression in edge-case behavior for empty `path`
|
||||
|
||||
0.16.0 / 2017-09-27
|
||||
===================
|
||||
|
||||
* Add `immutable` option
|
||||
* Fix missing `</html>` in default error & redirects
|
||||
* Use instance methods on steam to check for listeners
|
||||
* deps: mime@1.4.1
|
||||
- Add 70 new types for file extensions
|
||||
- Set charset as "UTF-8" for .js and .json
|
||||
* perf: improve path validation speed
|
||||
|
||||
0.15.6 / 2017-09-22
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.9
|
||||
* perf: improve `If-Match` token parsing
|
||||
|
||||
0.15.5 / 2017-09-20
|
||||
===================
|
||||
|
||||
* deps: etag@~1.8.1
|
||||
- perf: replace regular expression with substring
|
||||
* deps: fresh@0.5.2
|
||||
- Fix handling of modified headers with invalid dates
|
||||
- perf: improve ETag match loop
|
||||
- perf: improve `If-None-Match` token parsing
|
||||
|
||||
0.15.4 / 2017-08-05
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.8
|
||||
* deps: depd@~1.1.1
|
||||
- Remove unnecessary `Buffer` loading
|
||||
* deps: http-errors@~1.6.2
|
||||
- deps: depd@1.1.1
|
||||
|
||||
0.15.3 / 2017-05-16
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.7
|
||||
- deps: ms@2.0.0
|
||||
* deps: ms@2.0.0
|
||||
|
||||
0.15.2 / 2017-04-26
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.4
|
||||
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||
- deps: ms@0.7.3
|
||||
* deps: ms@1.0.0
|
||||
|
||||
0.15.1 / 2017-03-04
|
||||
===================
|
||||
|
||||
* Fix issue when `Date.parse` does not return `NaN` on invalid date
|
||||
* Fix strict violation in broken environments
|
||||
|
||||
0.15.0 / 2017-02-25
|
||||
===================
|
||||
|
||||
* Support `If-Match` and `If-Unmodified-Since` headers
|
||||
* Add `res` and `path` arguments to `directory` event
|
||||
* Remove usage of `res._headers` private field
|
||||
- Improves compatibility with Node.js 8 nightly
|
||||
* Send complete HTML document in redirect & error responses
|
||||
* Set default CSP header in redirect & error responses
|
||||
* Use `res.getHeaderNames()` when available
|
||||
* Use `res.headersSent` when available
|
||||
* deps: debug@2.6.1
|
||||
- Allow colors in workers
|
||||
- Deprecated `DEBUG_FD` environment variable set to `3` or higher
|
||||
- Fix error when running under React Native
|
||||
- Use same color for same namespace
|
||||
- deps: ms@0.7.2
|
||||
* deps: etag@~1.8.0
|
||||
* deps: fresh@0.5.0
|
||||
- Fix false detection of `no-cache` request directive
|
||||
- Fix incorrect result when `If-None-Match` has both `*` and ETags
|
||||
- Fix weak `ETag` matching to match spec
|
||||
- perf: delay reading header values until needed
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expressions
|
||||
- perf: remove duplicate conditional
|
||||
- perf: remove unnecessary boolean coercions
|
||||
- perf: skip checking modified time if ETag check failed
|
||||
- perf: skip parsing `If-None-Match` when no `ETag` header
|
||||
- perf: use `Date.parse` instead of `new Date`
|
||||
* deps: http-errors@~1.6.1
|
||||
- Make `message` property enumerable for `HttpError`s
|
||||
- deps: setprototypeof@1.0.3
|
||||
|
||||
0.14.2 / 2017-01-23
|
||||
===================
|
||||
|
||||
* deps: http-errors@~1.5.1
|
||||
- deps: inherits@2.0.3
|
||||
- deps: setprototypeof@1.0.2
|
||||
- deps: statuses@'>= 1.3.1 < 2'
|
||||
* deps: ms@0.7.2
|
||||
* deps: statuses@~1.3.1
|
||||
|
||||
0.14.1 / 2016-06-09
|
||||
===================
|
||||
|
||||
* Fix redirect error when `path` contains raw non-URL characters
|
||||
* Fix redirect when `path` starts with multiple forward slashes
|
||||
|
||||
0.14.0 / 2016-06-06
|
||||
===================
|
||||
|
||||
* Add `acceptRanges` option
|
||||
* Add `cacheControl` option
|
||||
* Attempt to combine multiple ranges into single range
|
||||
* Correctly inherit from `Stream` class
|
||||
* Fix `Content-Range` header in 416 responses when using `start`/`end` options
|
||||
* Fix `Content-Range` header missing from default 416 responses
|
||||
* Ignore non-byte `Range` headers
|
||||
* deps: http-errors@~1.5.0
|
||||
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||
- Support new code `421 Misdirected Request`
|
||||
- Use `setprototypeof` module to replace `__proto__` setting
|
||||
- deps: inherits@2.0.1
|
||||
- deps: statuses@'>= 1.3.0 < 2'
|
||||
- perf: enable strict mode
|
||||
* deps: range-parser@~1.2.0
|
||||
- Fix incorrectly returning -1 when there is at least one valid range
|
||||
- perf: remove internal function
|
||||
* deps: statuses@~1.3.0
|
||||
- Add `421 Misdirected Request`
|
||||
- perf: enable strict mode
|
||||
* perf: remove argument reassignment
|
||||
|
||||
0.13.2 / 2016-03-05
|
||||
===================
|
||||
|
||||
* Fix invalid `Content-Type` header when `send.mime.default_type` unset
|
||||
|
||||
0.13.1 / 2016-01-16
|
||||
===================
|
||||
|
||||
* deps: depd@~1.1.0
|
||||
- Support web browser loading
|
||||
- perf: enable strict mode
|
||||
* deps: destroy@~1.0.4
|
||||
- perf: enable strict mode
|
||||
* deps: escape-html@~1.0.3
|
||||
- perf: enable strict mode
|
||||
- perf: optimize string replacement
|
||||
- perf: use faster string coercion
|
||||
* deps: range-parser@~1.0.3
|
||||
- perf: enable strict mode
|
||||
|
||||
0.13.0 / 2015-06-16
|
||||
===================
|
||||
|
||||
* Allow Node.js HTTP server to set `Date` response header
|
||||
* Fix incorrectly removing `Content-Location` on 304 response
|
||||
* Improve the default redirect response headers
|
||||
* Send appropriate headers on default error response
|
||||
* Use `http-errors` for standard emitted errors
|
||||
* Use `statuses` instead of `http` module for status messages
|
||||
* deps: escape-html@1.0.2
|
||||
* deps: etag@~1.7.0
|
||||
- Improve stat performance by removing hashing
|
||||
* deps: fresh@0.3.0
|
||||
- Add weak `ETag` matching support
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary array allocations
|
||||
|
||||
0.12.3 / 2015-05-13
|
||||
===================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
* deps: depd@~1.0.1
|
||||
* deps: etag@~1.6.0
|
||||
- Improve support for JXcore
|
||||
- Support "fake" stats objects in environments without `fs`
|
||||
* deps: ms@0.7.1
|
||||
- Prevent extraordinarily long inputs
|
||||
* deps: on-finished@~2.2.1
|
||||
|
||||
0.12.2 / 2015-03-13
|
||||
===================
|
||||
|
||||
* Throw errors early for invalid `extensions` or `index` options
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
0.12.1 / 2015-02-17
|
||||
===================
|
||||
|
||||
* Fix regression sending zero-length files
|
||||
|
||||
0.12.0 / 2015-02-16
|
||||
===================
|
||||
|
||||
* Always read the stat size from the file
|
||||
* Fix mutating passed-in `options`
|
||||
* deps: mime@1.3.4
|
||||
|
||||
0.11.1 / 2015-01-20
|
||||
===================
|
||||
|
||||
* Fix `root` path disclosure
|
||||
|
||||
0.11.0 / 2015-01-05
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: etag@~1.5.1
|
||||
- deps: crc@3.2.1
|
||||
* deps: ms@0.7.0
|
||||
- Add `milliseconds`
|
||||
- Add `msecs`
|
||||
- Add `secs`
|
||||
- Add `mins`
|
||||
- Add `hrs`
|
||||
- Add `yrs`
|
||||
* deps: on-finished@~2.2.0
|
||||
|
||||
0.10.1 / 2014-10-22
|
||||
===================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
|
||||
0.10.0 / 2014-10-15
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
* deps: depd@~1.0.0
|
||||
* deps: etag@~1.5.0
|
||||
- Improve string performance
|
||||
- Slightly improve speed for weak ETags over 1KB
|
||||
|
||||
0.9.3 / 2014-09-24
|
||||
==================
|
||||
|
||||
* deps: etag@~1.4.0
|
||||
- Support "fake" stats objects
|
||||
|
||||
0.9.2 / 2014-09-15
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.5
|
||||
* deps: etag@~1.3.1
|
||||
* deps: range-parser@~1.0.2
|
||||
|
||||
0.9.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* deps: fresh@0.2.4
|
||||
|
||||
0.9.0 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Add `lastModified` option
|
||||
* Use `etag` to generate `ETag` header
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
0.8.5 / 2014-09-04
|
||||
==================
|
||||
|
||||
* Fix malicious path detection for empty string path
|
||||
|
||||
0.8.4 / 2014-09-04
|
||||
==================
|
||||
|
||||
* Fix a path traversal issue when using `root`
|
||||
|
||||
0.8.3 / 2014-08-16
|
||||
==================
|
||||
|
||||
* deps: destroy@1.0.3
|
||||
- renamed from dethroy
|
||||
* deps: on-finished@2.1.0
|
||||
|
||||
0.8.2 / 2014-08-14
|
||||
==================
|
||||
|
||||
* Work around `fd` leak in Node.js 0.10 for `fs.ReadStream`
|
||||
* deps: dethroy@1.0.2
|
||||
|
||||
0.8.1 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Fix `extensions` behavior when file already has extension
|
||||
|
||||
0.8.0 / 2014-08-05
|
||||
==================
|
||||
|
||||
* Add `extensions` option
|
||||
|
||||
0.7.4 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Fix serving index files without root dir
|
||||
|
||||
0.7.3 / 2014-07-29
|
||||
==================
|
||||
|
||||
* Fix incorrect 403 on Windows and Node.js 0.11
|
||||
|
||||
0.7.2 / 2014-07-27
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.4
|
||||
- Work-around v8 generating empty stack traces
|
||||
|
||||
0.7.1 / 2014-07-26
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.3
|
||||
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
0.7.0 / 2014-07-20
|
||||
==================
|
||||
|
||||
* Deprecate `hidden` option; use `dotfiles` option
|
||||
* Add `dotfiles` option
|
||||
* deps: debug@1.0.4
|
||||
* deps: depd@0.4.2
|
||||
- Add `TRACE_DEPRECATION` environment variable
|
||||
- Remove non-standard grey color from color output
|
||||
- Support `--no-deprecation` argument
|
||||
- Support `--trace-deprecation` argument
|
||||
|
||||
0.6.0 / 2014-07-11
|
||||
==================
|
||||
|
||||
* Deprecate `from` option; use `root` option
|
||||
* Deprecate `send.etag()` -- use `etag` in `options`
|
||||
* Deprecate `send.hidden()` -- use `hidden` in `options`
|
||||
* Deprecate `send.index()` -- use `index` in `options`
|
||||
* Deprecate `send.maxage()` -- use `maxAge` in `options`
|
||||
* Deprecate `send.root()` -- use `root` in `options`
|
||||
* Cap `maxAge` value to 1 year
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
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
|
||||
==================
|
||||
|
||||
* Do not throw un-catchable error on file open race condition
|
||||
* Use `escape-html` for HTML escaping
|
||||
* deps: debug@1.0.2
|
||||
- fix some debugging output colors on node.js 0.8
|
||||
* deps: finished@1.2.2
|
||||
* deps: fresh@0.2.2
|
||||
|
||||
0.4.2 / 2014-06-09
|
||||
==================
|
||||
|
||||
* fix "event emitter leak" warnings
|
||||
* deps: debug@1.0.1
|
||||
* deps: finished@1.2.1
|
||||
|
||||
0.4.1 / 2014-06-02
|
||||
==================
|
||||
|
||||
* Send `max-age` in `Cache-Control` in correct format
|
||||
|
||||
0.4.0 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Calculate ETag with md5 for reduced collisions
|
||||
* Fix wrong behavior when index file matches directory
|
||||
* Ignore stream errors after request ends
|
||||
- Goodbye `EBADF, read`
|
||||
* Skip directories in index file search
|
||||
* deps: debug@0.8.1
|
||||
|
||||
0.3.0 / 2014-04-24
|
||||
==================
|
||||
|
||||
* Fix sending files with dots without root set
|
||||
* Coerce option types
|
||||
* Accept API options in options object
|
||||
* Set etags to "weak"
|
||||
* Include file path in etag
|
||||
* Make "Can't set headers after they are sent." catchable
|
||||
* Send full entity-body for multi range requests
|
||||
* Default directory access to 403 when index disabled
|
||||
* Support multiple index paths
|
||||
* Support "If-Range" header
|
||||
* Control whether to generate etags
|
||||
* deps: mime@1.2.11
|
||||
|
||||
0.2.0 / 2014-01-29
|
||||
==================
|
||||
|
||||
* update range-parser and fresh
|
||||
|
||||
0.1.4 / 2013-08-11
|
||||
==================
|
||||
|
||||
* update fresh
|
||||
|
||||
0.1.3 / 2013-07-08
|
||||
==================
|
||||
|
||||
* Revert "Fix fd leak"
|
||||
|
||||
0.1.2 / 2013-07-03
|
||||
==================
|
||||
|
||||
* Fix fd leak
|
||||
|
||||
0.1.0 / 2012-08-25
|
||||
==================
|
||||
|
||||
* add options parameter to send() that is passed to fs.createReadStream() [kanongil]
|
||||
|
||||
0.0.4 / 2012-08-16
|
||||
==================
|
||||
|
||||
* allow custom "Accept-Ranges" definition
|
||||
|
||||
0.0.3 / 2012-07-16
|
||||
==================
|
||||
|
||||
* fix normalization of the root directory. Closes #3
|
||||
|
||||
0.0.2 / 2012-07-09
|
||||
==================
|
||||
|
||||
* add passing of req explicitly for now (YUCK)
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/send/LICENSE
generated
vendored
Normal file
23
node_modules/send/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 TJ Holowaychuk
|
||||
Copyright (c) 2014-2022 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.
|
||||
327
node_modules/send/README.md
generated
vendored
Normal file
327
node_modules/send/README.md
generated
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
# send
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Send is a library for streaming files from the file system as a http response
|
||||
supporting partial responses (Ranges), conditional-GET negotiation (If-Match,
|
||||
If-Unmodified-Since, If-None-Match, If-Modified-Since), high test coverage,
|
||||
and granular events which may be leveraged to take appropriate actions in your
|
||||
application or framework.
|
||||
|
||||
Looking to serve up entire folders mapped to URLs? Try [serve-static](https://www.npmjs.org/package/serve-static).
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```bash
|
||||
$ npm install send
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var send = require('send')
|
||||
```
|
||||
|
||||
### send(req, path, [options])
|
||||
|
||||
Create a new `SendStream` for the given path to send to a `res`. The `req` is
|
||||
the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded,
|
||||
not the actual file-system path).
|
||||
|
||||
#### Options
|
||||
|
||||
##### acceptRanges
|
||||
|
||||
Enable or disable accepting ranged requests, defaults to true.
|
||||
Disabling this will not send `Accept-Ranges` and ignore the contents
|
||||
of the `Range` request header.
|
||||
|
||||
##### cacheControl
|
||||
|
||||
Enable or disable setting `Cache-Control` response header, defaults to
|
||||
true. Disabling this will ignore the `immutable` and `maxAge` options.
|
||||
|
||||
##### dotfiles
|
||||
|
||||
Set how "dotfiles" are treated when encountered. A dotfile is a file
|
||||
or directory that begins with a dot ("."). Note this check is done on
|
||||
the path itself without checking if the path actually exists on the
|
||||
disk. If `root` is specified, only the dotfiles above the root are
|
||||
checked (i.e. the root itself can be within a dotfile when when set
|
||||
to "deny").
|
||||
|
||||
- `'allow'` No special treatment for dotfiles.
|
||||
- `'deny'` Send a 403 for any request for a dotfile.
|
||||
- `'ignore'` Pretend like the dotfile does not exist and 404.
|
||||
|
||||
The default value is _similar_ to `'ignore'`, with the exception that
|
||||
this default will not ignore the files within a directory that begins
|
||||
with a dot, for backward-compatibility.
|
||||
|
||||
##### end
|
||||
|
||||
Byte offset at which the stream ends, defaults to the length of the file
|
||||
minus 1. The end is inclusive in the stream, meaning `end: 3` will include
|
||||
the 4th byte in the stream.
|
||||
|
||||
##### etag
|
||||
|
||||
Enable or disable etag generation, defaults to true.
|
||||
|
||||
##### extensions
|
||||
|
||||
If a given file doesn't exist, try appending one of the given extensions,
|
||||
in the given order. By default, this is disabled (set to `false`). An
|
||||
example value that will serve extension-less HTML files: `['html', 'htm']`.
|
||||
This is skipped if the requested file already has an extension.
|
||||
|
||||
##### immutable
|
||||
|
||||
Enable or disable the `immutable` directive in the `Cache-Control` response
|
||||
header, defaults to `false`. If set to `true`, the `maxAge` option should
|
||||
also be specified to enable caching. The `immutable` directive will prevent
|
||||
supported clients from making conditional requests during the life of the
|
||||
`maxAge` option to check if the file has changed.
|
||||
|
||||
##### index
|
||||
|
||||
By default send supports "index.html" files, to disable this
|
||||
set `false` or to supply a new index pass a string or an array
|
||||
in preferred order.
|
||||
|
||||
##### lastModified
|
||||
|
||||
Enable or disable `Last-Modified` header, defaults to true. Uses the file
|
||||
system's last modified value.
|
||||
|
||||
##### maxAge
|
||||
|
||||
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
|
||||
|
||||
Serve files relative to `path`.
|
||||
|
||||
##### start
|
||||
|
||||
Byte offset at which the stream starts, defaults to 0. The start is inclusive,
|
||||
meaning `start: 2` will include the 3rd byte in the stream.
|
||||
|
||||
#### Events
|
||||
|
||||
The `SendStream` is an event emitter and will emit the following events:
|
||||
|
||||
- `error` an error occurred `(err)`
|
||||
- `directory` a directory was requested `(res, path)`
|
||||
- `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)`
|
||||
- `end` streaming has completed
|
||||
|
||||
#### .pipe
|
||||
|
||||
The `pipe` method is used to pipe the response into the Node.js HTTP response
|
||||
object, typically `send(req, path, options).pipe(res)`.
|
||||
|
||||
### .mime
|
||||
|
||||
The `mime` export is the global instance of of the
|
||||
[`mime` npm module](https://www.npmjs.com/package/mime).
|
||||
|
||||
This is used to configure the MIME types that are associated with file extensions
|
||||
as well as other options for how to resolve the MIME type of a file (like the
|
||||
default type to use for an unknown file extension).
|
||||
|
||||
## Error-handling
|
||||
|
||||
By default when no `error` listeners are present an automatic response will be
|
||||
made, otherwise you have full control over the response, aka you may show a 5xx
|
||||
page etc.
|
||||
|
||||
## Caching
|
||||
|
||||
It does _not_ perform internal caching, you should use a reverse proxy cache
|
||||
such as Varnish for this, or those fancy things called CDNs. If your
|
||||
application is small enough that it would benefit from single-node memory
|
||||
caching, it's small enough that it does not need caching at all ;).
|
||||
|
||||
## Debugging
|
||||
|
||||
To enable `debug()` instrumentation output export __DEBUG__:
|
||||
|
||||
```
|
||||
$ DEBUG=send node app
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
```
|
||||
$ npm install
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### 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')
|
||||
var parseUrl = require('parseurl')
|
||||
var send = require('send')
|
||||
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
send(req, parseUrl(req).pathname, { root: '/www/public' })
|
||||
.pipe(res)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### Custom file types
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var parseUrl = require('parseurl')
|
||||
var send = require('send')
|
||||
|
||||
// Default unknown types to text/plain
|
||||
send.mime.default_type = 'text/plain'
|
||||
|
||||
// Add a custom type
|
||||
send.mime.define({
|
||||
'application/x-my-type': ['x-mt', 'x-mtt']
|
||||
})
|
||||
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
send(req, parseUrl(req).pathname, { root: '/www/public' })
|
||||
.pipe(res)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### Custom directory index view
|
||||
|
||||
This is a example of serving up a structure of directories with a
|
||||
custom function to render a listing of a directory.
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var fs = require('fs')
|
||||
var parseUrl = require('parseurl')
|
||||
var send = require('send')
|
||||
|
||||
// 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/public' })
|
||||
.once('directory', directory)
|
||||
.pipe(res)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
|
||||
// Custom directory handler
|
||||
function directory (res, path) {
|
||||
var stream = this
|
||||
|
||||
// redirect to trailing slash for consistent url
|
||||
if (!stream.hasTrailingSlash()) {
|
||||
return stream.redirect(path)
|
||||
}
|
||||
|
||||
// get directory list
|
||||
fs.readdir(path, function onReaddir (err, list) {
|
||||
if (err) return stream.error(err)
|
||||
|
||||
// render an index for the directory
|
||||
res.setHeader('Content-Type', 'text/plain; charset=UTF-8')
|
||||
res.end(list.join('\n') + '\n')
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
### Serving from a root directory with custom error-handling
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var parseUrl = require('parseurl')
|
||||
var send = require('send')
|
||||
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
// your custom error-handling logic:
|
||||
function error (err) {
|
||||
res.statusCode = err.status || 500
|
||||
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:
|
||||
function redirect () {
|
||||
res.statusCode = 301
|
||||
res.setHeader('Location', req.url + '/')
|
||||
res.end('Redirecting to ' + req.url + '/')
|
||||
}
|
||||
|
||||
// transfer arbitrary files from within
|
||||
// /www/example.com/public/*
|
||||
send(req, parseUrl(req).pathname, { root: '/www/public' })
|
||||
.on('error', error)
|
||||
.on('directory', redirect)
|
||||
.on('headers', headers)
|
||||
.pipe(res)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux
|
||||
[github-actions-ci-url]: https://github.com/pillarjs/send/actions/workflows/ci.yml
|
||||
[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
|
||||
24
node_modules/send/SECURITY.md
generated
vendored
Normal file
24
node_modules/send/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Security Policies and Procedures
|
||||
|
||||
## Reporting a Bug
|
||||
|
||||
The `send` team and community take all security bugs seriously. Thank you
|
||||
for improving the security of Express. We appreciate your efforts and
|
||||
responsible disclosure and will make every effort to acknowledge your
|
||||
contributions.
|
||||
|
||||
Report security bugs by emailing the current owner(s) of `send`. This information
|
||||
can be found in the npm registry using the command `npm owner ls send`.
|
||||
If unsure or unable to get the information from the above, open an issue
|
||||
in the [project issue tracker](https://github.com/pillarjs/send/issues)
|
||||
asking for the current contact information.
|
||||
|
||||
To ensure the timely response to your report, please ensure that the entirety
|
||||
of the report is contained within the email body and not solely behind a web
|
||||
link or an attachment.
|
||||
|
||||
At least one owner will acknowledge your email within 48 hours, and will send a
|
||||
more detailed response within 48 hours indicating the next steps in handling
|
||||
your report. After the initial reply to your report, the owners will
|
||||
endeavor to keep you informed of the progress towards a fix and full
|
||||
announcement, and may ask for additional information or guidance.
|
||||
1142
node_modules/send/index.js
generated
vendored
Normal file
1142
node_modules/send/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/send/node_modules/.bin/mime
generated
vendored
Symbolic link
1
node_modules/send/node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
0
node_modules/send/node_modules/mime/.npmignore
generated
vendored
Normal file
0
node_modules/send/node_modules/mime/.npmignore
generated
vendored
Normal file
164
node_modules/send/node_modules/mime/CHANGELOG.md
generated
vendored
Normal file
164
node_modules/send/node_modules/mime/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
# Changelog
|
||||
|
||||
## v1.6.0 (24/11/2017)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v2.0.4 (24/11/2017)
|
||||
- [**closed**] Switch to mime-score module for resolving extension contention issues. [#182](https://github.com/broofa/node-mime/issues/182)
|
||||
- [**closed**] Update mime-db to 1.31.0 in v1.x branch [#181](https://github.com/broofa/node-mime/issues/181)
|
||||
|
||||
---
|
||||
|
||||
## v1.5.0 (22/11/2017)
|
||||
- [**closed**] need ES5 version ready in npm package [#179](https://github.com/broofa/node-mime/issues/179)
|
||||
- [**closed**] mime-db no trace of iWork - pages / numbers / etc. [#178](https://github.com/broofa/node-mime/issues/178)
|
||||
- [**closed**] How it works in brownser ? [#176](https://github.com/broofa/node-mime/issues/176)
|
||||
- [**closed**] Missing `./Mime` [#175](https://github.com/broofa/node-mime/issues/175)
|
||||
- [**closed**] Vulnerable Regular Expression [#167](https://github.com/broofa/node-mime/issues/167)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.3 (25/09/2017)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.4.1 (25/09/2017)
|
||||
- [**closed**] Issue when bundling with webpack [#172](https://github.com/broofa/node-mime/issues/172)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.2 (15/09/2017)
|
||||
- [**V2**] fs.readFileSync is not a function [#165](https://github.com/broofa/node-mime/issues/165)
|
||||
- [**closed**] The extension for video/quicktime should map to .mov, not .qt [#164](https://github.com/broofa/node-mime/issues/164)
|
||||
- [**V2**] [v2 Feedback request] Mime class API [#163](https://github.com/broofa/node-mime/issues/163)
|
||||
- [**V2**] [v2 Feedback request] Resolving conflicts over extensions [#162](https://github.com/broofa/node-mime/issues/162)
|
||||
- [**V2**] Allow callers to load module with official, full, or no defined types. [#161](https://github.com/broofa/node-mime/issues/161)
|
||||
- [**V2**] Use "facets" to resolve extension conflicts [#160](https://github.com/broofa/node-mime/issues/160)
|
||||
- [**V2**] Remove fs and path dependencies [#152](https://github.com/broofa/node-mime/issues/152)
|
||||
- [**V2**] Default content-type should not be application/octet-stream [#139](https://github.com/broofa/node-mime/issues/139)
|
||||
- [**V2**] reset mime-types [#124](https://github.com/broofa/node-mime/issues/124)
|
||||
- [**V2**] Extensionless paths should return null or false [#113](https://github.com/broofa/node-mime/issues/113)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.1 (14/09/2017)
|
||||
- [**closed**] Changelog for v2.0 does not mention breaking changes [#171](https://github.com/broofa/node-mime/issues/171)
|
||||
- [**closed**] MIME breaking with 'class' declaration as it is without 'use strict mode' [#170](https://github.com/broofa/node-mime/issues/170)
|
||||
|
||||
---
|
||||
|
||||
## v2.0.0 (12/09/2017)
|
||||
- [**closed**] woff and woff2 [#168](https://github.com/broofa/node-mime/issues/168)
|
||||
|
||||
---
|
||||
|
||||
## v1.4.0 (28/08/2017)
|
||||
- [**closed**] support for ac3 voc files [#159](https://github.com/broofa/node-mime/issues/159)
|
||||
- [**closed**] Help understanding change from application/xml to text/xml [#158](https://github.com/broofa/node-mime/issues/158)
|
||||
- [**closed**] no longer able to override mimetype [#157](https://github.com/broofa/node-mime/issues/157)
|
||||
- [**closed**] application/vnd.adobe.photoshop [#147](https://github.com/broofa/node-mime/issues/147)
|
||||
- [**closed**] Directories should appear as something other than application/octet-stream [#135](https://github.com/broofa/node-mime/issues/135)
|
||||
- [**closed**] requested features [#131](https://github.com/broofa/node-mime/issues/131)
|
||||
- [**closed**] Make types.json loading optional? [#129](https://github.com/broofa/node-mime/issues/129)
|
||||
- [**closed**] Cannot find module './types.json' [#120](https://github.com/broofa/node-mime/issues/120)
|
||||
- [**V2**] .wav files show up as "audio/x-wav" instead of "audio/x-wave" [#118](https://github.com/broofa/node-mime/issues/118)
|
||||
- [**closed**] Don't be a pain in the ass for node community [#108](https://github.com/broofa/node-mime/issues/108)
|
||||
- [**closed**] don't make default_type global [#78](https://github.com/broofa/node-mime/issues/78)
|
||||
- [**closed**] mime.extension() fails if the content-type is parameterized [#74](https://github.com/broofa/node-mime/issues/74)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.6 (11/05/2017)
|
||||
- [**closed**] .md should be text/markdown as of March 2016 [#154](https://github.com/broofa/node-mime/issues/154)
|
||||
- [**closed**] Error while installing mime [#153](https://github.com/broofa/node-mime/issues/153)
|
||||
- [**closed**] application/manifest+json [#149](https://github.com/broofa/node-mime/issues/149)
|
||||
- [**closed**] Dynamic adaptive streaming over HTTP (DASH) file extension typo [#141](https://github.com/broofa/node-mime/issues/141)
|
||||
- [**closed**] charsets image/png undefined [#140](https://github.com/broofa/node-mime/issues/140)
|
||||
- [**closed**] Mime-db dependency out of date [#130](https://github.com/broofa/node-mime/issues/130)
|
||||
- [**closed**] how to support plist? [#126](https://github.com/broofa/node-mime/issues/126)
|
||||
- [**closed**] how does .types file format look like? [#123](https://github.com/broofa/node-mime/issues/123)
|
||||
- [**closed**] Feature: support for expanding MIME patterns [#121](https://github.com/broofa/node-mime/issues/121)
|
||||
- [**closed**] DEBUG_MIME doesn't work [#117](https://github.com/broofa/node-mime/issues/117)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.4 (06/02/2015)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.3.3 (06/02/2015)
|
||||
*No changelog for this release.*
|
||||
|
||||
---
|
||||
|
||||
## v1.3.1 (05/02/2015)
|
||||
- [**closed**] Consider adding support for Handlebars .hbs file ending [#111](https://github.com/broofa/node-mime/issues/111)
|
||||
- [**closed**] Consider adding support for hjson. [#110](https://github.com/broofa/node-mime/issues/110)
|
||||
- [**closed**] Add mime type for Opus audio files [#94](https://github.com/broofa/node-mime/issues/94)
|
||||
- [**closed**] Consider making the `Requesting New Types` information more visible [#77](https://github.com/broofa/node-mime/issues/77)
|
||||
|
||||
---
|
||||
|
||||
## v1.3.0 (05/02/2015)
|
||||
- [**closed**] Add common name? [#114](https://github.com/broofa/node-mime/issues/114)
|
||||
- [**closed**] application/x-yaml [#104](https://github.com/broofa/node-mime/issues/104)
|
||||
- [**closed**] Add mime type for WOFF file format 2.0 [#102](https://github.com/broofa/node-mime/issues/102)
|
||||
- [**closed**] application/x-msi for .msi [#99](https://github.com/broofa/node-mime/issues/99)
|
||||
- [**closed**] Add mimetype for gettext translation files [#98](https://github.com/broofa/node-mime/issues/98)
|
||||
- [**closed**] collaborators [#88](https://github.com/broofa/node-mime/issues/88)
|
||||
- [**closed**] getting errot in installation of mime module...any1 can help? [#87](https://github.com/broofa/node-mime/issues/87)
|
||||
- [**closed**] should application/json's charset be utf8? [#86](https://github.com/broofa/node-mime/issues/86)
|
||||
- [**closed**] Add "license" and "licenses" to package.json [#81](https://github.com/broofa/node-mime/issues/81)
|
||||
- [**closed**] lookup with extension-less file on Windows returns wrong type [#68](https://github.com/broofa/node-mime/issues/68)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.11 (15/08/2013)
|
||||
- [**closed**] Update mime.types [#65](https://github.com/broofa/node-mime/issues/65)
|
||||
- [**closed**] Publish a new version [#63](https://github.com/broofa/node-mime/issues/63)
|
||||
- [**closed**] README should state upfront that "application/octet-stream" is default for unknown extension [#55](https://github.com/broofa/node-mime/issues/55)
|
||||
- [**closed**] Suggested improvement to the charset API [#52](https://github.com/broofa/node-mime/issues/52)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.10 (25/07/2013)
|
||||
- [**closed**] Mime type for woff files should be application/font-woff and not application/x-font-woff [#62](https://github.com/broofa/node-mime/issues/62)
|
||||
- [**closed**] node.types in conflict with mime.types [#51](https://github.com/broofa/node-mime/issues/51)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.9 (17/01/2013)
|
||||
- [**closed**] Please update "mime" NPM [#49](https://github.com/broofa/node-mime/issues/49)
|
||||
- [**closed**] Please add semicolon [#46](https://github.com/broofa/node-mime/issues/46)
|
||||
- [**closed**] parse full mime types [#43](https://github.com/broofa/node-mime/issues/43)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.8 (10/01/2013)
|
||||
- [**closed**] /js directory mime is application/javascript. Is it correct? [#47](https://github.com/broofa/node-mime/issues/47)
|
||||
- [**closed**] Add mime types for lua code. [#45](https://github.com/broofa/node-mime/issues/45)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.7 (19/10/2012)
|
||||
- [**closed**] cannot install 1.2.7 via npm [#41](https://github.com/broofa/node-mime/issues/41)
|
||||
- [**closed**] Transfer ownership to @broofa [#36](https://github.com/broofa/node-mime/issues/36)
|
||||
- [**closed**] it's wrong to set charset to UTF-8 for text [#30](https://github.com/broofa/node-mime/issues/30)
|
||||
- [**closed**] Allow multiple instances of MIME types container [#27](https://github.com/broofa/node-mime/issues/27)
|
||||
|
||||
---
|
||||
|
||||
## v1.2.5 (16/02/2012)
|
||||
- [**closed**] When looking up a types, check hasOwnProperty [#23](https://github.com/broofa/node-mime/issues/23)
|
||||
- [**closed**] Bump version to 1.2.2 [#18](https://github.com/broofa/node-mime/issues/18)
|
||||
- [**closed**] No license [#16](https://github.com/broofa/node-mime/issues/16)
|
||||
- [**closed**] Some types missing that are used by html5/css3 [#13](https://github.com/broofa/node-mime/issues/13)
|
||||
- [**closed**] npm install fails for 1.2.1 [#12](https://github.com/broofa/node-mime/issues/12)
|
||||
- [**closed**] image/pjpeg + image/x-png [#10](https://github.com/broofa/node-mime/issues/10)
|
||||
- [**closed**] symlink [#8](https://github.com/broofa/node-mime/issues/8)
|
||||
- [**closed**] gzip [#2](https://github.com/broofa/node-mime/issues/2)
|
||||
- [**closed**] ALL CAPS filenames return incorrect mime type [#1](https://github.com/broofa/node-mime/issues/1)
|
||||
21
node_modules/send/node_modules/mime/LICENSE
generated
vendored
Normal file
21
node_modules/send/node_modules/mime/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
90
node_modules/send/node_modules/mime/README.md
generated
vendored
Normal file
90
node_modules/send/node_modules/mime/README.md
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
# mime
|
||||
|
||||
Comprehensive MIME type mapping API based on mime-db module.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
npm install mime
|
||||
|
||||
## Contributing / Testing
|
||||
|
||||
npm run test
|
||||
|
||||
## Command Line
|
||||
|
||||
mime [path_string]
|
||||
|
||||
E.g.
|
||||
|
||||
> mime scripts/jquery.js
|
||||
application/javascript
|
||||
|
||||
## API - Queries
|
||||
|
||||
### mime.lookup(path)
|
||||
Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
|
||||
|
||||
```js
|
||||
var mime = require('mime');
|
||||
|
||||
mime.lookup('/path/to/file.txt'); // => 'text/plain'
|
||||
mime.lookup('file.txt'); // => 'text/plain'
|
||||
mime.lookup('.TXT'); // => 'text/plain'
|
||||
mime.lookup('htm'); // => 'text/html'
|
||||
```
|
||||
|
||||
### mime.default_type
|
||||
Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
|
||||
|
||||
### mime.extension(type)
|
||||
Get the default extension for `type`
|
||||
|
||||
```js
|
||||
mime.extension('text/html'); // => 'html'
|
||||
mime.extension('application/octet-stream'); // => 'bin'
|
||||
```
|
||||
|
||||
### mime.charsets.lookup()
|
||||
|
||||
Map mime-type to charset
|
||||
|
||||
```js
|
||||
mime.charsets.lookup('text/plain'); // => 'UTF-8'
|
||||
```
|
||||
|
||||
(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
|
||||
|
||||
## API - Defining Custom Types
|
||||
|
||||
Custom type mappings can be added on a per-project basis via the following APIs.
|
||||
|
||||
### mime.define()
|
||||
|
||||
Add custom mime/extension mappings
|
||||
|
||||
```js
|
||||
mime.define({
|
||||
'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
|
||||
'application/x-my-type': ['x-mt', 'x-mtt'],
|
||||
// etc ...
|
||||
});
|
||||
|
||||
mime.lookup('x-sft'); // => 'text/x-some-format'
|
||||
```
|
||||
|
||||
The first entry in the extensions array is returned by `mime.extension()`. E.g.
|
||||
|
||||
```js
|
||||
mime.extension('text/x-some-format'); // => 'x-sf'
|
||||
```
|
||||
|
||||
### mime.load(filepath)
|
||||
|
||||
Load mappings from an Apache ".types" format file
|
||||
|
||||
```js
|
||||
mime.load('./my_project.types');
|
||||
```
|
||||
The .types file format is simple - See the `types` dir for examples.
|
||||
8
node_modules/send/node_modules/mime/cli.js
generated
vendored
Executable file
8
node_modules/send/node_modules/mime/cli.js
generated
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var mime = require('./mime.js');
|
||||
var file = process.argv[2];
|
||||
var type = mime.lookup(file);
|
||||
|
||||
process.stdout.write(type + '\n');
|
||||
|
||||
108
node_modules/send/node_modules/mime/mime.js
generated
vendored
Normal file
108
node_modules/send/node_modules/mime/mime.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
function Mime() {
|
||||
// Map of extension -> mime type
|
||||
this.types = Object.create(null);
|
||||
|
||||
// Map of mime type -> extension
|
||||
this.extensions = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define mimetype -> extension mappings. Each key is a mime-type that maps
|
||||
* to an array of extensions associated with the type. The first extension is
|
||||
* used as the default extension for the type.
|
||||
*
|
||||
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
|
||||
*
|
||||
* @param map (Object) type definitions
|
||||
*/
|
||||
Mime.prototype.define = function (map) {
|
||||
for (var type in map) {
|
||||
var exts = map[type];
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
if (process.env.DEBUG_MIME && this.types[exts[i]]) {
|
||||
console.warn((this._loading || "define()").replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
|
||||
this.types[exts[i]] + ' to ' + type);
|
||||
}
|
||||
|
||||
this.types[exts[i]] = type;
|
||||
}
|
||||
|
||||
// Default extension is the first one we encounter
|
||||
if (!this.extensions[type]) {
|
||||
this.extensions[type] = exts[0];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Load an Apache2-style ".types" file
|
||||
*
|
||||
* This may be called multiple times (it's expected). Where files declare
|
||||
* overlapping types/extensions, the last file wins.
|
||||
*
|
||||
* @param file (String) path of file to load.
|
||||
*/
|
||||
Mime.prototype.load = function(file) {
|
||||
this._loading = file;
|
||||
// Read file and split into lines
|
||||
var map = {},
|
||||
content = fs.readFileSync(file, 'ascii'),
|
||||
lines = content.split(/[\r\n]+/);
|
||||
|
||||
lines.forEach(function(line) {
|
||||
// Clean up whitespace/comments, and split into fields
|
||||
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
|
||||
map[fields.shift()] = fields;
|
||||
});
|
||||
|
||||
this.define(map);
|
||||
|
||||
this._loading = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup a mime type based on extension
|
||||
*/
|
||||
Mime.prototype.lookup = function(path, fallback) {
|
||||
var ext = path.replace(/^.*[\.\/\\]/, '').toLowerCase();
|
||||
|
||||
return this.types[ext] || fallback || this.default_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return file extension associated with a mime type
|
||||
*/
|
||||
Mime.prototype.extension = function(mimeType) {
|
||||
var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
|
||||
return this.extensions[type];
|
||||
};
|
||||
|
||||
// Default instance
|
||||
var mime = new Mime();
|
||||
|
||||
// Define built-in types
|
||||
mime.define(require('./types.json'));
|
||||
|
||||
// Default type
|
||||
mime.default_type = mime.lookup('bin');
|
||||
|
||||
//
|
||||
// Additional API specific to the default instance
|
||||
//
|
||||
|
||||
mime.Mime = Mime;
|
||||
|
||||
/**
|
||||
* Lookup a charset based on mime type.
|
||||
*/
|
||||
mime.charsets = {
|
||||
lookup: function(mimeType, fallback) {
|
||||
// Assume text types are utf8
|
||||
return (/^text\/|^application\/(javascript|json)/).test(mimeType) ? 'UTF-8' : fallback;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = mime;
|
||||
44
node_modules/send/node_modules/mime/package.json
generated
vendored
Normal file
44
node_modules/send/node_modules/mime/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Robert Kieffer",
|
||||
"url": "http://github.com/broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Thomas",
|
||||
"url": "http://github.com/bentomas",
|
||||
"email": "benjamin@benjaminthomas.org"
|
||||
}
|
||||
],
|
||||
"description": "A comprehensive library for mime-type mapping",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"github-release-notes": "0.13.1",
|
||||
"mime-db": "1.31.0",
|
||||
"mime-score": "1.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "node src/build.js",
|
||||
"changelog": "gren changelog --tags=all --generate --override",
|
||||
"test": "node src/test.js"
|
||||
},
|
||||
"keywords": [
|
||||
"util",
|
||||
"mime"
|
||||
],
|
||||
"main": "mime.js",
|
||||
"name": "mime",
|
||||
"repository": {
|
||||
"url": "https://github.com/broofa/node-mime",
|
||||
"type": "git"
|
||||
},
|
||||
"version": "1.6.0"
|
||||
}
|
||||
53
node_modules/send/node_modules/mime/src/build.js
generated
vendored
Executable file
53
node_modules/send/node_modules/mime/src/build.js
generated
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const mimeScore = require('mime-score');
|
||||
|
||||
let db = require('mime-db');
|
||||
let chalk = require('chalk');
|
||||
|
||||
const STANDARD_FACET_SCORE = 900;
|
||||
|
||||
const byExtension = {};
|
||||
|
||||
// Clear out any conflict extensions in mime-db
|
||||
for (let type in db) {
|
||||
let entry = db[type];
|
||||
entry.type = type;
|
||||
|
||||
if (!entry.extensions) continue;
|
||||
|
||||
entry.extensions.forEach(ext => {
|
||||
if (ext in byExtension) {
|
||||
const e0 = entry;
|
||||
const e1 = byExtension[ext];
|
||||
e0.pri = mimeScore(e0.type, e0.source);
|
||||
e1.pri = mimeScore(e1.type, e1.source);
|
||||
|
||||
let drop = e0.pri < e1.pri ? e0 : e1;
|
||||
let keep = e0.pri >= e1.pri ? e0 : e1;
|
||||
drop.extensions = drop.extensions.filter(e => e !== ext);
|
||||
|
||||
console.log(`${ext}: Keeping ${chalk.green(keep.type)} (${keep.pri}), dropping ${chalk.red(drop.type)} (${drop.pri})`);
|
||||
}
|
||||
byExtension[ext] = entry;
|
||||
});
|
||||
}
|
||||
|
||||
function writeTypesFile(types, path) {
|
||||
fs.writeFileSync(path, JSON.stringify(types));
|
||||
}
|
||||
|
||||
// Segregate into standard and non-standard types based on facet per
|
||||
// https://tools.ietf.org/html/rfc6838#section-3.1
|
||||
const types = {};
|
||||
|
||||
Object.keys(db).sort().forEach(k => {
|
||||
const entry = db[k];
|
||||
types[entry.type] = entry.extensions;
|
||||
});
|
||||
|
||||
writeTypesFile(types, path.join(__dirname, '..', 'types.json'));
|
||||
60
node_modules/send/node_modules/mime/src/test.js
generated
vendored
Normal file
60
node_modules/send/node_modules/mime/src/test.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Usage: node test.js
|
||||
*/
|
||||
|
||||
var mime = require('../mime');
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
|
||||
//
|
||||
// Test mime lookups
|
||||
//
|
||||
|
||||
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
|
||||
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
|
||||
assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file
|
||||
assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file
|
||||
assert.equal('text/plain', mime.lookup('.txt')); // nameless
|
||||
assert.equal('text/plain', mime.lookup('txt')); // extension-only
|
||||
assert.equal('text/plain', mime.lookup('/txt')); // extension-less ()
|
||||
assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less
|
||||
assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized
|
||||
assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
|
||||
|
||||
//
|
||||
// Test extensions
|
||||
//
|
||||
|
||||
assert.equal('txt', mime.extension(mime.types.text));
|
||||
assert.equal('html', mime.extension(mime.types.htm));
|
||||
assert.equal('bin', mime.extension('application/octet-stream'));
|
||||
assert.equal('bin', mime.extension('application/octet-stream '));
|
||||
assert.equal('html', mime.extension(' text/html; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html; charset=UTF-8 '));
|
||||
assert.equal('html', mime.extension('text/html; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html ; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html;charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/Html;charset=UTF-8'));
|
||||
assert.equal(undefined, mime.extension('unrecognized'));
|
||||
|
||||
//
|
||||
// Test node.types lookups
|
||||
//
|
||||
|
||||
assert.equal('font/woff', mime.lookup('file.woff'));
|
||||
assert.equal('application/octet-stream', mime.lookup('file.buffer'));
|
||||
// TODO: Uncomment once #157 is resolved
|
||||
// assert.equal('audio/mp4', mime.lookup('file.m4a'));
|
||||
assert.equal('font/otf', mime.lookup('file.otf'));
|
||||
|
||||
//
|
||||
// Test charsets
|
||||
//
|
||||
|
||||
assert.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
||||
assert.equal('UTF-8', mime.charsets.lookup(mime.types.js));
|
||||
assert.equal('UTF-8', mime.charsets.lookup(mime.types.json));
|
||||
assert.equal(undefined, mime.charsets.lookup(mime.types.bin));
|
||||
assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
||||
|
||||
console.log('\nAll tests passed');
|
||||
1
node_modules/send/node_modules/mime/types.json
generated
vendored
Normal file
1
node_modules/send/node_modules/mime/types.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
162
node_modules/send/node_modules/ms/index.js
generated
vendored
Normal file
162
node_modules/send/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function (val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isFinite(val)) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'weeks':
|
||||
case 'week':
|
||||
case 'w':
|
||||
return n * w;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, 'day');
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, 'hour');
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, 'minute');
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, 'second');
|
||||
}
|
||||
return ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, msAbs, n, name) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||||
}
|
||||
21
node_modules/send/node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/send/node_modules/ms/license.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Vercel, Inc.
|
||||
|
||||
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.
|
||||
38
node_modules/send/node_modules/ms/package.json
generated
vendored
Normal file
38
node_modules/send/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "2.1.3",
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"repository": "vercel/ms",
|
||||
"main": "./index",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "4.18.2",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "5.0.0",
|
||||
"mocha": "4.0.1",
|
||||
"prettier": "2.0.5"
|
||||
}
|
||||
}
|
||||
59
node_modules/send/node_modules/ms/readme.md
generated
vendored
Normal file
59
node_modules/send/node_modules/ms/readme.md
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# ms
|
||||
|
||||

|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
ms('-3 days') // -259200000
|
||||
ms('-1h') // -3600000
|
||||
ms('-200') // -200
|
||||
```
|
||||
|
||||
### Convert from Milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(-3 * 60000) // "-3m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time Format Written-Out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [Node.js](https://nodejs.org) and in the browser
|
||||
- If a number is supplied to `ms`, a string with a unit is returned
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
||||
|
||||
## Related Packages
|
||||
|
||||
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
||||
|
||||
## Caught a Bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
||||
98
node_modules/send/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
98
node_modules/send/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
2.4.1 / 2022-02-22
|
||||
==================
|
||||
|
||||
* Fix error on early async hooks implementations
|
||||
|
||||
2.4.0 / 2022-02-21
|
||||
==================
|
||||
|
||||
* Prevent loss of async hooks context
|
||||
|
||||
2.3.0 / 2015-05-26
|
||||
==================
|
||||
|
||||
* Add defined behavior for HTTP `CONNECT` requests
|
||||
* Add defined behavior for HTTP `Upgrade` requests
|
||||
* deps: ee-first@1.1.1
|
||||
|
||||
2.2.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Fix `isFinished(req)` when data buffered
|
||||
|
||||
2.2.0 / 2014-12-22
|
||||
==================
|
||||
|
||||
* Add message object to callback arguments
|
||||
|
||||
2.1.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Fix handling of pipelined requests
|
||||
|
||||
2.1.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Check if `socket` is detached
|
||||
* Return `undefined` for `isFinished` if state unknown
|
||||
|
||||
2.0.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Add `isFinished` function
|
||||
* Move to `jshttp` organization
|
||||
* Remove support for plain socket argument
|
||||
* Rename to `on-finished`
|
||||
* Support both `req` and `res` as arguments
|
||||
* deps: ee-first@1.0.5
|
||||
|
||||
1.2.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* Reduce listeners added to emitters
|
||||
- avoids "event emitter leak" warnings when used multiple times on same request
|
||||
|
||||
1.2.1 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Fix returned value when already finished
|
||||
|
||||
1.2.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Call callback when called on already-finished socket
|
||||
|
||||
1.1.4 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Support node.js 0.8
|
||||
|
||||
1.1.3 / 2014-04-30
|
||||
==================
|
||||
|
||||
* Make sure errors passed as instanceof `Error`
|
||||
|
||||
1.1.2 / 2014-04-18
|
||||
==================
|
||||
|
||||
* Default the `socket` to passed-in object
|
||||
|
||||
1.1.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Rename module to `finished`
|
||||
|
||||
1.1.0 / 2013-12-25
|
||||
==================
|
||||
|
||||
* Call callback when called on already-errored socket
|
||||
|
||||
1.0.1 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Actually pass the error to the callback
|
||||
|
||||
1.0.0 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/send/node_modules/on-finished/LICENSE
generated
vendored
Normal file
23
node_modules/send/node_modules/on-finished/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
||||
162
node_modules/send/node_modules/on-finished/README.md
generated
vendored
Normal file
162
node_modules/send/node_modules/on-finished/README.md
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
# on-finished
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a callback when a HTTP request closes, finishes, or errors.
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install on-finished
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var onFinished = require('on-finished')
|
||||
```
|
||||
|
||||
### onFinished(res, listener)
|
||||
|
||||
Attach a listener to listen for the response to finish. The listener will
|
||||
be invoked only once when the response finished. If the response finished
|
||||
to an error, the first argument will contain the error. If the response
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a response would be used to close things associated
|
||||
with the response, like open files.
|
||||
|
||||
Listener is invoked as `listener(err, res)`.
|
||||
|
||||
<!-- eslint-disable handle-callback-err -->
|
||||
|
||||
```js
|
||||
onFinished(res, function (err, res) {
|
||||
// clean up open fds, etc.
|
||||
// err contains the error if request error'd
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished(req, listener)
|
||||
|
||||
Attach a listener to listen for the request to finish. The listener will
|
||||
be invoked only once when the request finished. If the request finished
|
||||
to an error, the first argument will contain the error. If the request
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a request would be used to know when to continue
|
||||
after reading the data.
|
||||
|
||||
Listener is invoked as `listener(err, req)`.
|
||||
|
||||
<!-- eslint-disable handle-callback-err -->
|
||||
|
||||
```js
|
||||
var data = ''
|
||||
|
||||
req.setEncoding('utf8')
|
||||
req.on('data', function (str) {
|
||||
data += str
|
||||
})
|
||||
|
||||
onFinished(req, function (err, req) {
|
||||
// data is read unless there is err
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished.isFinished(res)
|
||||
|
||||
Determine if `res` is already finished. This would be useful to check and
|
||||
not even start certain operations if the response has already finished.
|
||||
|
||||
### onFinished.isFinished(req)
|
||||
|
||||
Determine if `req` is already finished. This would be useful to check and
|
||||
not even start certain operations if the request has already finished.
|
||||
|
||||
## Special Node.js requests
|
||||
|
||||
### HTTP CONNECT method
|
||||
|
||||
The meaning of the `CONNECT` method from RFC 7231, section 4.3.6:
|
||||
|
||||
> The CONNECT method requests that the recipient establish a tunnel to
|
||||
> the destination origin server identified by the request-target and,
|
||||
> if successful, thereafter restrict its behavior to blind forwarding
|
||||
> of packets, in both directions, until the tunnel is closed. Tunnels
|
||||
> are commonly used to create an end-to-end virtual connection, through
|
||||
> one or more proxies, which can then be secured using TLS (Transport
|
||||
> Layer Security, [RFC5246]).
|
||||
|
||||
In Node.js, these request objects come from the `'connect'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP `CONNECT` request, the request is
|
||||
considered "finished" immediately, **due to limitations in the Node.js
|
||||
interface**. This means if the `CONNECT` request contains a request entity,
|
||||
the request will be considered "finished" even before it has been read.
|
||||
|
||||
There is no such thing as a response object to a `CONNECT` request in
|
||||
Node.js, so there is no support for one.
|
||||
|
||||
### HTTP Upgrade request
|
||||
|
||||
The meaning of the `Upgrade` header from RFC 7230, section 6.1:
|
||||
|
||||
> The "Upgrade" header field is intended to provide a simple mechanism
|
||||
> for transitioning from HTTP/1.1 to some other protocol on the same
|
||||
> connection.
|
||||
|
||||
In Node.js, these request objects come from the `'upgrade'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP request with an `Upgrade` header, the
|
||||
request is considered "finished" immediately, **due to limitations in the
|
||||
Node.js interface**. This means if the `Upgrade` request contains a request
|
||||
entity, the request will be considered "finished" even before it has been
|
||||
read.
|
||||
|
||||
There is no such thing as a response object to a `Upgrade` request in
|
||||
Node.js, so there is no support for one.
|
||||
|
||||
## Example
|
||||
|
||||
The following code ensures that file descriptors are always closed
|
||||
once the response finishes.
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
http.createServer(function onRequest (req, res) {
|
||||
var stream = fs.createReadStream('package.json')
|
||||
stream.pipe(res)
|
||||
onFinished(res, function () {
|
||||
destroy(stream)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/on-finished/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/on-finished/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-finished/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master
|
||||
[node-image]: https://badgen.net/npm/node/on-finished
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/on-finished
|
||||
[npm-url]: https://npmjs.org/package/on-finished
|
||||
[npm-version-image]: https://badgen.net/npm/v/on-finished
|
||||
234
node_modules/send/node_modules/on-finished/index.js
generated
vendored
Normal file
234
node_modules/send/node_modules/on-finished/index.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
/*!
|
||||
* on-finished
|
||||
* Copyright(c) 2013 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = onFinished
|
||||
module.exports.isFinished = isFinished
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var asyncHooks = tryRequireAsyncHooks()
|
||||
var first = require('ee-first')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Invoke callback when the response has finished, useful for
|
||||
* cleaning up resources afterwards.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} listener
|
||||
* @return {object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function onFinished (msg, listener) {
|
||||
if (isFinished(msg) !== false) {
|
||||
defer(listener, null, msg)
|
||||
return msg
|
||||
}
|
||||
|
||||
// attach the listener to the message
|
||||
attachListener(msg, wrap(listener))
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if message is already finished.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function isFinished (msg) {
|
||||
var socket = msg.socket
|
||||
|
||||
if (typeof msg.finished === 'boolean') {
|
||||
// OutgoingMessage
|
||||
return Boolean(msg.finished || (socket && !socket.writable))
|
||||
}
|
||||
|
||||
if (typeof msg.complete === 'boolean') {
|
||||
// IncomingMessage
|
||||
return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable))
|
||||
}
|
||||
|
||||
// don't know
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a finished listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachFinishedListener (msg, callback) {
|
||||
var eeMsg
|
||||
var eeSocket
|
||||
var finished = false
|
||||
|
||||
function onFinish (error) {
|
||||
eeMsg.cancel()
|
||||
eeSocket.cancel()
|
||||
|
||||
finished = true
|
||||
callback(error)
|
||||
}
|
||||
|
||||
// finished on first message event
|
||||
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
|
||||
|
||||
function onSocket (socket) {
|
||||
// remove listener
|
||||
msg.removeListener('socket', onSocket)
|
||||
|
||||
if (finished) return
|
||||
if (eeMsg !== eeSocket) return
|
||||
|
||||
// finished on first socket event
|
||||
eeSocket = first([[socket, 'error', 'close']], onFinish)
|
||||
}
|
||||
|
||||
if (msg.socket) {
|
||||
// socket already assigned
|
||||
onSocket(msg.socket)
|
||||
return
|
||||
}
|
||||
|
||||
// wait for socket to be assigned
|
||||
msg.on('socket', onSocket)
|
||||
|
||||
if (msg.socket === undefined) {
|
||||
// istanbul ignore next: node.js 0.8 patch
|
||||
patchAssignSocket(msg, onSocket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachListener (msg, listener) {
|
||||
var attached = msg.__onFinished
|
||||
|
||||
// create a private single listener with queue
|
||||
if (!attached || !attached.queue) {
|
||||
attached = msg.__onFinished = createListener(msg)
|
||||
attachFinishedListener(msg, attached)
|
||||
}
|
||||
|
||||
attached.queue.push(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create listener on message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createListener (msg) {
|
||||
function listener (err) {
|
||||
if (msg.__onFinished === listener) msg.__onFinished = null
|
||||
if (!listener.queue) return
|
||||
|
||||
var queue = listener.queue
|
||||
listener.queue = null
|
||||
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
queue[i](err, msg)
|
||||
}
|
||||
}
|
||||
|
||||
listener.queue = []
|
||||
|
||||
return listener
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch ServerResponse.prototype.assignSocket for node.js 0.8.
|
||||
*
|
||||
* @param {ServerResponse} res
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
// istanbul ignore next: node.js 0.8 patch
|
||||
function patchAssignSocket (res, callback) {
|
||||
var assignSocket = res.assignSocket
|
||||
|
||||
if (typeof assignSocket !== 'function') return
|
||||
|
||||
// res.on('socket', callback) is broken in 0.8
|
||||
res.assignSocket = function _assignSocket (socket) {
|
||||
assignSocket.call(this, socket)
|
||||
callback(socket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to require async_hooks
|
||||
* @private
|
||||
*/
|
||||
|
||||
function tryRequireAsyncHooks () {
|
||||
try {
|
||||
return require('async_hooks')
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap function with async resource, if possible.
|
||||
* AsyncResource.bind static method backported.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function wrap (fn) {
|
||||
var res
|
||||
|
||||
// create anonymous resource
|
||||
if (asyncHooks.AsyncResource) {
|
||||
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
|
||||
}
|
||||
|
||||
// incompatible node.js
|
||||
if (!res || !res.runInAsyncScope) {
|
||||
return fn
|
||||
}
|
||||
|
||||
// return bound function
|
||||
return res.runInAsyncScope.bind(res, fn, null)
|
||||
}
|
||||
39
node_modules/send/node_modules/on-finished/package.json
generated
vendored
Normal file
39
node_modules/send/node_modules/on-finished/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "on-finished",
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"version": "2.4.1",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/on-finished",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.1",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
82
node_modules/send/node_modules/statuses/HISTORY.md
generated
vendored
Normal file
82
node_modules/send/node_modules/statuses/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
2.0.1 / 2021-01-03
|
||||
==================
|
||||
|
||||
* Fix returning values from `Object.prototype`
|
||||
|
||||
2.0.0 / 2020-04-19
|
||||
==================
|
||||
|
||||
* Drop support for Node.js 0.6
|
||||
* Fix messaging casing of `418 I'm a Teapot`
|
||||
* Remove code 306
|
||||
* Remove `status[code]` exports; use `status.message[code]`
|
||||
* Remove `status[msg]` exports; use `status.code[msg]`
|
||||
* Rename `425 Unordered Collection` to standard `425 Too Early`
|
||||
* Rename `STATUS_CODES` export to `message`
|
||||
* Return status message for `statuses(code)` when given code
|
||||
|
||||
1.5.0 / 2018-03-27
|
||||
==================
|
||||
|
||||
* Add `103 Early Hints`
|
||||
|
||||
1.4.0 / 2017-10-20
|
||||
==================
|
||||
|
||||
* Add `STATUS_CODES` export
|
||||
|
||||
1.3.1 / 2016-11-11
|
||||
==================
|
||||
|
||||
* Fix return type in JSDoc
|
||||
|
||||
1.3.0 / 2016-05-17
|
||||
==================
|
||||
|
||||
* Add `421 Misdirected Request`
|
||||
* perf: enable strict mode
|
||||
|
||||
1.2.1 / 2015-02-01
|
||||
==================
|
||||
|
||||
* Fix message for status 451
|
||||
- `451 Unavailable For Legal Reasons`
|
||||
|
||||
1.2.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `208 Already Repored`
|
||||
* Add `226 IM Used`
|
||||
* Add `306 (Unused)`
|
||||
* Add `415 Unable For Legal Reasons`
|
||||
* Add `508 Loop Detected`
|
||||
|
||||
1.1.1 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Add missing 308 to `codes.json`
|
||||
|
||||
1.1.0 / 2014-09-21
|
||||
==================
|
||||
|
||||
* Add `codes.json` for universal support
|
||||
|
||||
1.0.4 / 2014-08-20
|
||||
==================
|
||||
|
||||
* Package cleanup
|
||||
|
||||
1.0.3 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Add 308 to `.redirect` category
|
||||
|
||||
1.0.2 / 2014-03-13
|
||||
==================
|
||||
|
||||
* Add `.retry` category
|
||||
|
||||
1.0.1 / 2014-03-12
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/send/node_modules/statuses/LICENSE
generated
vendored
Normal file
23
node_modules/send/node_modules/statuses/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
||||
136
node_modules/send/node_modules/statuses/README.md
generated
vendored
Normal file
136
node_modules/send/node_modules/statuses/README.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# statuses
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP status utility for node.
|
||||
|
||||
This module provides a list of status codes and messages sourced from
|
||||
a few different projects:
|
||||
|
||||
* The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
|
||||
* The [Node.js project](https://nodejs.org/)
|
||||
* The [NGINX project](https://www.nginx.com/)
|
||||
* The [Apache HTTP Server project](https://httpd.apache.org/)
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install statuses
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var status = require('statuses')
|
||||
```
|
||||
|
||||
### status(code)
|
||||
|
||||
Returns the status message string for a known HTTP status code. The code
|
||||
may be a number or a string. An error is thrown for an unknown status code.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
status(403) // => 'Forbidden'
|
||||
status('403') // => 'Forbidden'
|
||||
status(306) // throws
|
||||
```
|
||||
|
||||
### status(msg)
|
||||
|
||||
Returns the numeric status code for a known HTTP status message. The message
|
||||
is case-insensitive. An error is thrown for an unknown status message.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
status('forbidden') // => 403
|
||||
status('Forbidden') // => 403
|
||||
status('foo') // throws
|
||||
```
|
||||
|
||||
### status.codes
|
||||
|
||||
Returns an array of all the status codes as `Integer`s.
|
||||
|
||||
### status.code[msg]
|
||||
|
||||
Returns the numeric status code for a known status message (in lower-case),
|
||||
otherwise `undefined`.
|
||||
|
||||
<!-- eslint-disable no-undef, no-unused-expressions -->
|
||||
|
||||
```js
|
||||
status['not found'] // => 404
|
||||
```
|
||||
|
||||
### status.empty[code]
|
||||
|
||||
Returns `true` if a status code expects an empty body.
|
||||
|
||||
<!-- eslint-disable no-undef, no-unused-expressions -->
|
||||
|
||||
```js
|
||||
status.empty[200] // => undefined
|
||||
status.empty[204] // => true
|
||||
status.empty[304] // => true
|
||||
```
|
||||
|
||||
### status.message[code]
|
||||
|
||||
Returns the string message for a known numeric status code, otherwise
|
||||
`undefined`. This object is the same format as the
|
||||
[Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
|
||||
|
||||
<!-- eslint-disable no-undef, no-unused-expressions -->
|
||||
|
||||
```js
|
||||
status.message[404] // => 'Not Found'
|
||||
```
|
||||
|
||||
### status.redirect[code]
|
||||
|
||||
Returns `true` if a status code is a valid redirect status.
|
||||
|
||||
<!-- eslint-disable no-undef, no-unused-expressions -->
|
||||
|
||||
```js
|
||||
status.redirect[200] // => undefined
|
||||
status.redirect[301] // => true
|
||||
```
|
||||
|
||||
### status.retry[code]
|
||||
|
||||
Returns `true` if you should retry the rest.
|
||||
|
||||
<!-- eslint-disable no-undef, no-unused-expressions -->
|
||||
|
||||
```js
|
||||
status.retry[501] // => undefined
|
||||
status.retry[503] // => true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/statuses
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/statuses
|
||||
[npm-url]: https://npmjs.org/package/statuses
|
||||
[npm-version-image]: https://badgen.net/npm/v/statuses
|
||||
65
node_modules/send/node_modules/statuses/codes.json
generated
vendored
Normal file
65
node_modules/send/node_modules/statuses/codes.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"100": "Continue",
|
||||
"101": "Switching Protocols",
|
||||
"102": "Processing",
|
||||
"103": "Early Hints",
|
||||
"200": "OK",
|
||||
"201": "Created",
|
||||
"202": "Accepted",
|
||||
"203": "Non-Authoritative Information",
|
||||
"204": "No Content",
|
||||
"205": "Reset Content",
|
||||
"206": "Partial Content",
|
||||
"207": "Multi-Status",
|
||||
"208": "Already Reported",
|
||||
"226": "IM Used",
|
||||
"300": "Multiple Choices",
|
||||
"301": "Moved Permanently",
|
||||
"302": "Found",
|
||||
"303": "See Other",
|
||||
"304": "Not Modified",
|
||||
"305": "Use Proxy",
|
||||
"307": "Temporary Redirect",
|
||||
"308": "Permanent Redirect",
|
||||
"400": "Bad Request",
|
||||
"401": "Unauthorized",
|
||||
"402": "Payment Required",
|
||||
"403": "Forbidden",
|
||||
"404": "Not Found",
|
||||
"405": "Method Not Allowed",
|
||||
"406": "Not Acceptable",
|
||||
"407": "Proxy Authentication Required",
|
||||
"408": "Request Timeout",
|
||||
"409": "Conflict",
|
||||
"410": "Gone",
|
||||
"411": "Length Required",
|
||||
"412": "Precondition Failed",
|
||||
"413": "Payload Too Large",
|
||||
"414": "URI Too Long",
|
||||
"415": "Unsupported Media Type",
|
||||
"416": "Range Not Satisfiable",
|
||||
"417": "Expectation Failed",
|
||||
"418": "I'm a Teapot",
|
||||
"421": "Misdirected Request",
|
||||
"422": "Unprocessable Entity",
|
||||
"423": "Locked",
|
||||
"424": "Failed Dependency",
|
||||
"425": "Too Early",
|
||||
"426": "Upgrade Required",
|
||||
"428": "Precondition Required",
|
||||
"429": "Too Many Requests",
|
||||
"431": "Request Header Fields Too Large",
|
||||
"451": "Unavailable For Legal Reasons",
|
||||
"500": "Internal Server Error",
|
||||
"501": "Not Implemented",
|
||||
"502": "Bad Gateway",
|
||||
"503": "Service Unavailable",
|
||||
"504": "Gateway Timeout",
|
||||
"505": "HTTP Version Not Supported",
|
||||
"506": "Variant Also Negotiates",
|
||||
"507": "Insufficient Storage",
|
||||
"508": "Loop Detected",
|
||||
"509": "Bandwidth Limit Exceeded",
|
||||
"510": "Not Extended",
|
||||
"511": "Network Authentication Required"
|
||||
}
|
||||
146
node_modules/send/node_modules/statuses/index.js
generated
vendored
Normal file
146
node_modules/send/node_modules/statuses/index.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/*!
|
||||
* statuses
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2016 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var codes = require('./codes.json')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = status
|
||||
|
||||
// status code to message map
|
||||
status.message = codes
|
||||
|
||||
// status message (lower-case) to code map
|
||||
status.code = createMessageToStatusCodeMap(codes)
|
||||
|
||||
// array of status codes
|
||||
status.codes = createStatusCodeList(codes)
|
||||
|
||||
// status codes for redirects
|
||||
status.redirect = {
|
||||
300: true,
|
||||
301: true,
|
||||
302: true,
|
||||
303: true,
|
||||
305: true,
|
||||
307: true,
|
||||
308: true
|
||||
}
|
||||
|
||||
// status codes for empty bodies
|
||||
status.empty = {
|
||||
204: true,
|
||||
205: true,
|
||||
304: true
|
||||
}
|
||||
|
||||
// status codes for when you should retry the request
|
||||
status.retry = {
|
||||
502: true,
|
||||
503: true,
|
||||
504: true
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a map of message to status code.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createMessageToStatusCodeMap (codes) {
|
||||
var map = {}
|
||||
|
||||
Object.keys(codes).forEach(function forEachCode (code) {
|
||||
var message = codes[code]
|
||||
var status = Number(code)
|
||||
|
||||
// populate map
|
||||
map[message.toLowerCase()] = status
|
||||
})
|
||||
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a list of all status codes.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createStatusCodeList (codes) {
|
||||
return Object.keys(codes).map(function mapCode (code) {
|
||||
return Number(code)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status code for given message.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getStatusCode (message) {
|
||||
var msg = message.toLowerCase()
|
||||
|
||||
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
||||
throw new Error('invalid status message: "' + message + '"')
|
||||
}
|
||||
|
||||
return status.code[msg]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status message for given code.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getStatusMessage (code) {
|
||||
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
||||
throw new Error('invalid status code: ' + code)
|
||||
}
|
||||
|
||||
return status.message[code]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status code.
|
||||
*
|
||||
* Given a number, this will throw if it is not a known status
|
||||
* code, otherwise the code will be returned. Given a string,
|
||||
* the string will be parsed for a number and return the code
|
||||
* if valid, otherwise will lookup the code assuming this is
|
||||
* the status message.
|
||||
*
|
||||
* @param {string|number} code
|
||||
* @returns {number}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function status (code) {
|
||||
if (typeof code === 'number') {
|
||||
return getStatusMessage(code)
|
||||
}
|
||||
|
||||
if (typeof code !== 'string') {
|
||||
throw new TypeError('code must be a number or string')
|
||||
}
|
||||
|
||||
// '403'
|
||||
var n = parseInt(code, 10)
|
||||
if (!isNaN(n)) {
|
||||
return getStatusMessage(n)
|
||||
}
|
||||
|
||||
return getStatusCode(code)
|
||||
}
|
||||
49
node_modules/send/node_modules/statuses/package.json
generated
vendored
Normal file
49
node_modules/send/node_modules/statuses/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "statuses",
|
||||
"description": "HTTP status utility",
|
||||
"version": "2.0.1",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"repository": "jshttp/statuses",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"http",
|
||||
"status",
|
||||
"code"
|
||||
],
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"index.js",
|
||||
"codes.json",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"csv-parse": "4.14.2",
|
||||
"eslint": "7.17.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "8.2.1",
|
||||
"nyc": "15.1.0",
|
||||
"raw-body": "2.4.1",
|
||||
"stream-to-array": "2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"update": "npm run fetch && npm run build",
|
||||
"version": "node scripts/version-history.js && git add HISTORY.md"
|
||||
}
|
||||
}
|
||||
62
node_modules/send/package.json
generated
vendored
Normal file
62
node_modules/send/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "send",
|
||||
"description": "Better streaming static file server with Range and conditional-GET support",
|
||||
"version": "0.19.0",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"James Wyatt Cready <jcready@gmail.com>",
|
||||
"Jesús Leganés Combarro <piranna@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "pillarjs/send",
|
||||
"keywords": [
|
||||
"static",
|
||||
"file",
|
||||
"server"
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "2.0.0",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"after": "0.8.2",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.2",
|
||||
"nyc": "15.1.0",
|
||||
"supertest": "6.2.2"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"SECURITY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user