初始化
This commit is contained in:
580
node_modules/send/HISTORY.md
generated
vendored
Normal file
580
node_modules/send/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
1.2.0 / 2025-03-27
|
||||
==================
|
||||
|
||||
* deps:
|
||||
* `mime-types@^3.0.1`
|
||||
* `fresh@^2.0.0`
|
||||
* removed `destroy`
|
||||
* remove `getHeaderNames()` polyfill and refactor `clearHeaders()`
|
||||
|
||||
1.1.0 / 2024-09-10
|
||||
==================
|
||||
|
||||
* Changes from 0.19.0
|
||||
|
||||
1.0.0 / 2024-07-25
|
||||
==================
|
||||
|
||||
* Drop support for Node.js <18.0
|
||||
* `statuses@^2.0.1`
|
||||
* `range-parser@^1.2.1`
|
||||
* `on-finished@^2.4.1`
|
||||
* `ms@^2.1.3`
|
||||
* `mime-types@^2.1.35`
|
||||
* `http-errors@^2.0.0`
|
||||
* `fresh@^0.5.2`
|
||||
* `etag@^1.8.1`
|
||||
* `escape-html@^1.0.3`
|
||||
* `encodeurl@^2.0.0`
|
||||
* `destroy@^1.2.0`
|
||||
* `debug@^4.3.5`
|
||||
|
||||
1.0.0-beta.2 / 2024-03-04
|
||||
=========================
|
||||
|
||||
* Changes from 0.18.0
|
||||
|
||||
1.0.0-beta.1 / 2022-02-04
|
||||
=========================
|
||||
|
||||
* Drop support for Node.js 0.8
|
||||
* Remove `hidden` option -- use `dotfiles` option
|
||||
* Remove `from` alias to `root` -- use `root` directly
|
||||
* Remove `send.etag()` -- use `etag` in `options`
|
||||
* Remove `send.index()` -- use `index` in `options`
|
||||
* Remove `send.maxage()` -- use `maxAge` in `options`
|
||||
* Remove `send.root()` -- use `root` in `options`
|
||||
* Use `mime-types` for file to content type mapping -- removed `send.mime`
|
||||
* deps: debug@3.1.0
|
||||
- Add `DEBUG_HIDE_DATE` environment variable
|
||||
- Change timer to per-namespace instead of global
|
||||
- Change non-TTY date format
|
||||
- Remove `DEBUG_FD` environment variable support
|
||||
- Support 256 namespace colors
|
||||
|
||||
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.
|
||||
317
node_modules/send/README.md
generated
vendored
Normal file
317
node_modules/send/README.md
generated
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
# send
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![CI][github-actions-ci-image]][github-actions-ci-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 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)`.
|
||||
|
||||
## 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 extname = require('path').extname
|
||||
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' })
|
||||
.on('headers', function (res, path) {
|
||||
switch (extname(path)) {
|
||||
case '.x-mt':
|
||||
case '.x-mtt':
|
||||
// custom type for these extensions
|
||||
res.setHeader('Content-Type', 'application/x-my-type')
|
||||
break
|
||||
}
|
||||
})
|
||||
.pipe(res)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### Custom directory index view
|
||||
|
||||
This is an 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)
|
||||
|
||||
[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
|
||||
997
node_modules/send/index.js
generated
vendored
Normal file
997
node_modules/send/index.js
generated
vendored
Normal file
@@ -0,0 +1,997 @@
|
||||
/*!
|
||||
* send
|
||||
* Copyright(c) 2012 TJ Holowaychuk
|
||||
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var createError = require('http-errors')
|
||||
var debug = require('debug')('send')
|
||||
var encodeUrl = require('encodeurl')
|
||||
var escapeHtml = require('escape-html')
|
||||
var etag = require('etag')
|
||||
var fresh = require('fresh')
|
||||
var fs = require('fs')
|
||||
var mime = require('mime-types')
|
||||
var ms = require('ms')
|
||||
var onFinished = require('on-finished')
|
||||
var parseRange = require('range-parser')
|
||||
var path = require('path')
|
||||
var statuses = require('statuses')
|
||||
var Stream = require('stream')
|
||||
var util = require('util')
|
||||
|
||||
/**
|
||||
* Path function references.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var extname = path.extname
|
||||
var join = path.join
|
||||
var normalize = path.normalize
|
||||
var resolve = path.resolve
|
||||
var sep = path.sep
|
||||
|
||||
/**
|
||||
* Regular expression for identifying a bytes Range header.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var BYTES_RANGE_REGEXP = /^ *bytes=/
|
||||
|
||||
/**
|
||||
* Maximum value allowed for the max age.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000 // 1 year
|
||||
|
||||
/**
|
||||
* Regular expression to match a path with a directory up component.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = send
|
||||
|
||||
/**
|
||||
* Return a `SendStream` for `req` and `path`.
|
||||
*
|
||||
* @param {object} req
|
||||
* @param {string} path
|
||||
* @param {object} [options]
|
||||
* @return {SendStream}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function send (req, path, options) {
|
||||
return new SendStream(req, path, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a `SendStream` with the given `path`.
|
||||
*
|
||||
* @param {Request} req
|
||||
* @param {String} path
|
||||
* @param {object} [options]
|
||||
* @private
|
||||
*/
|
||||
|
||||
function SendStream (req, path, options) {
|
||||
Stream.call(this)
|
||||
|
||||
var opts = options || {}
|
||||
|
||||
this.options = opts
|
||||
this.path = path
|
||||
this.req = req
|
||||
|
||||
this._acceptRanges = opts.acceptRanges !== undefined
|
||||
? Boolean(opts.acceptRanges)
|
||||
: true
|
||||
|
||||
this._cacheControl = opts.cacheControl !== undefined
|
||||
? Boolean(opts.cacheControl)
|
||||
: true
|
||||
|
||||
this._etag = opts.etag !== undefined
|
||||
? Boolean(opts.etag)
|
||||
: true
|
||||
|
||||
this._dotfiles = opts.dotfiles !== undefined
|
||||
? opts.dotfiles
|
||||
: 'ignore'
|
||||
|
||||
if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
|
||||
throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
|
||||
}
|
||||
|
||||
this._extensions = opts.extensions !== undefined
|
||||
? normalizeList(opts.extensions, 'extensions option')
|
||||
: []
|
||||
|
||||
this._immutable = opts.immutable !== undefined
|
||||
? Boolean(opts.immutable)
|
||||
: false
|
||||
|
||||
this._index = opts.index !== undefined
|
||||
? normalizeList(opts.index, 'index option')
|
||||
: ['index.html']
|
||||
|
||||
this._lastModified = opts.lastModified !== undefined
|
||||
? Boolean(opts.lastModified)
|
||||
: true
|
||||
|
||||
this._maxage = opts.maxAge || opts.maxage
|
||||
this._maxage = typeof this._maxage === 'string'
|
||||
? ms(this._maxage)
|
||||
: Number(this._maxage)
|
||||
this._maxage = !isNaN(this._maxage)
|
||||
? Math.min(Math.max(0, this._maxage), MAX_MAXAGE)
|
||||
: 0
|
||||
|
||||
this._root = opts.root
|
||||
? resolve(opts.root)
|
||||
: null
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from `Stream`.
|
||||
*/
|
||||
|
||||
util.inherits(SendStream, Stream)
|
||||
|
||||
/**
|
||||
* Emit error with `status`.
|
||||
*
|
||||
* @param {number} status
|
||||
* @param {Error} [err]
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.error = function error (status, err) {
|
||||
// emit if listeners instead of responding
|
||||
if (hasListeners(this, 'error')) {
|
||||
return this.emit('error', createHttpError(status, err))
|
||||
}
|
||||
|
||||
var res = this.res
|
||||
var msg = statuses.message[status] || String(status)
|
||||
var doc = createHtmlDocument('Error', escapeHtml(msg))
|
||||
|
||||
// clear existing headers
|
||||
clearHeaders(res)
|
||||
|
||||
// add error headers
|
||||
if (err && err.headers) {
|
||||
setHeaders(res, err.headers)
|
||||
}
|
||||
|
||||
// send basic response
|
||||
res.statusCode = status
|
||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(doc))
|
||||
res.setHeader('Content-Security-Policy', "default-src 'none'")
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
res.end(doc)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the pathname ends with "/".
|
||||
*
|
||||
* @return {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.hasTrailingSlash = function hasTrailingSlash () {
|
||||
return this.path[this.path.length - 1] === '/'
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is a conditional GET request.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isConditionalGET = function isConditionalGET () {
|
||||
return this.req.headers['if-match'] ||
|
||||
this.req.headers['if-unmodified-since'] ||
|
||||
this.req.headers['if-none-match'] ||
|
||||
this.req.headers['if-modified-since']
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the request preconditions failed.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isPreconditionFailure = function isPreconditionFailure () {
|
||||
var req = this.req
|
||||
var res = this.res
|
||||
|
||||
// if-match
|
||||
var match = req.headers['if-match']
|
||||
if (match) {
|
||||
var etag = res.getHeader('ETag')
|
||||
return !etag || (match !== '*' && parseTokenList(match).every(function (match) {
|
||||
return match !== etag && match !== 'W/' + etag && 'W/' + match !== etag
|
||||
}))
|
||||
}
|
||||
|
||||
// if-unmodified-since
|
||||
var unmodifiedSince = parseHttpDate(req.headers['if-unmodified-since'])
|
||||
if (!isNaN(unmodifiedSince)) {
|
||||
var lastModified = parseHttpDate(res.getHeader('Last-Modified'))
|
||||
return isNaN(lastModified) || lastModified > unmodifiedSince
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip various content header fields for a change in entity.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields () {
|
||||
var res = this.res
|
||||
|
||||
res.removeHeader('Content-Encoding')
|
||||
res.removeHeader('Content-Language')
|
||||
res.removeHeader('Content-Length')
|
||||
res.removeHeader('Content-Range')
|
||||
res.removeHeader('Content-Type')
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with 304 not modified.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.notModified = function notModified () {
|
||||
var res = this.res
|
||||
debug('not modified')
|
||||
this.removeContentHeaderFields()
|
||||
res.statusCode = 304
|
||||
res.end()
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise error that headers already sent.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.headersAlreadySent = function headersAlreadySent () {
|
||||
var err = new Error('Can\'t set headers after they are sent.')
|
||||
debug('headers already sent')
|
||||
this.error(500, err)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the request is cacheable, aka
|
||||
* responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isCachable = function isCachable () {
|
||||
var statusCode = this.res.statusCode
|
||||
return (statusCode >= 200 && statusCode < 300) ||
|
||||
statusCode === 304
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle stat() error.
|
||||
*
|
||||
* @param {Error} error
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.onStatError = function onStatError (error) {
|
||||
switch (error.code) {
|
||||
case 'ENAMETOOLONG':
|
||||
case 'ENOENT':
|
||||
case 'ENOTDIR':
|
||||
this.error(404, error)
|
||||
break
|
||||
default:
|
||||
this.error(500, error)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the cache is fresh.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isFresh = function isFresh () {
|
||||
return fresh(this.req.headers, {
|
||||
etag: this.res.getHeader('ETag'),
|
||||
'last-modified': this.res.getHeader('Last-Modified')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the range is fresh.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.isRangeFresh = function isRangeFresh () {
|
||||
var ifRange = this.req.headers['if-range']
|
||||
|
||||
if (!ifRange) {
|
||||
return true
|
||||
}
|
||||
|
||||
// if-range as etag
|
||||
if (ifRange.indexOf('"') !== -1) {
|
||||
var etag = this.res.getHeader('ETag')
|
||||
return Boolean(etag && ifRange.indexOf(etag) !== -1)
|
||||
}
|
||||
|
||||
// if-range as modified date
|
||||
var lastModified = this.res.getHeader('Last-Modified')
|
||||
return parseHttpDate(lastModified) <= parseHttpDate(ifRange)
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to path.
|
||||
*
|
||||
* @param {string} path
|
||||
* @private
|
||||
*/
|
||||
|
||||
SendStream.prototype.redirect = function redirect (path) {
|
||||
var res = this.res
|
||||
|
||||
if (hasListeners(this, 'directory')) {
|
||||
this.emit('directory', res, path)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.hasTrailingSlash()) {
|
||||
this.error(403)
|
||||
return
|
||||
}
|
||||
|
||||
var loc = encodeUrl(collapseLeadingSlashes(this.path + '/'))
|
||||
var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + escapeHtml(loc))
|
||||
|
||||
// redirect
|
||||
res.statusCode = 301
|
||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(doc))
|
||||
res.setHeader('Content-Security-Policy', "default-src 'none'")
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
res.setHeader('Location', loc)
|
||||
res.end(doc)
|
||||
}
|
||||
|
||||
/**
|
||||
* Pipe to `res.
|
||||
*
|
||||
* @param {Stream} res
|
||||
* @return {Stream} res
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.pipe = function pipe (res) {
|
||||
// root path
|
||||
var root = this._root
|
||||
|
||||
// references
|
||||
this.res = res
|
||||
|
||||
// decode the path
|
||||
var path = decode(this.path)
|
||||
if (path === -1) {
|
||||
this.error(400)
|
||||
return res
|
||||
}
|
||||
|
||||
// null byte(s)
|
||||
if (~path.indexOf('\0')) {
|
||||
this.error(400)
|
||||
return res
|
||||
}
|
||||
|
||||
var parts
|
||||
if (root !== null) {
|
||||
// normalize
|
||||
if (path) {
|
||||
path = normalize('.' + sep + path)
|
||||
}
|
||||
|
||||
// malicious path
|
||||
if (UP_PATH_REGEXP.test(path)) {
|
||||
debug('malicious path "%s"', path)
|
||||
this.error(403)
|
||||
return res
|
||||
}
|
||||
|
||||
// explode path parts
|
||||
parts = path.split(sep)
|
||||
|
||||
// join / normalize from optional root dir
|
||||
path = normalize(join(root, path))
|
||||
} else {
|
||||
// ".." is malicious without "root"
|
||||
if (UP_PATH_REGEXP.test(path)) {
|
||||
debug('malicious path "%s"', path)
|
||||
this.error(403)
|
||||
return res
|
||||
}
|
||||
|
||||
// explode path parts
|
||||
parts = normalize(path).split(sep)
|
||||
|
||||
// resolve the path
|
||||
path = resolve(path)
|
||||
}
|
||||
|
||||
// dotfile handling
|
||||
if (containsDotFile(parts)) {
|
||||
debug('%s dotfile "%s"', this._dotfiles, path)
|
||||
switch (this._dotfiles) {
|
||||
case 'allow':
|
||||
break
|
||||
case 'deny':
|
||||
this.error(403)
|
||||
return res
|
||||
case 'ignore':
|
||||
default:
|
||||
this.error(404)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
// index file support
|
||||
if (this._index.length && this.hasTrailingSlash()) {
|
||||
this.sendIndex(path)
|
||||
return res
|
||||
}
|
||||
|
||||
this.sendFile(path)
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.send = function send (path, stat) {
|
||||
var len = stat.size
|
||||
var options = this.options
|
||||
var opts = {}
|
||||
var res = this.res
|
||||
var req = this.req
|
||||
var ranges = req.headers.range
|
||||
var offset = options.start || 0
|
||||
|
||||
if (res.headersSent) {
|
||||
// impossible to send now
|
||||
this.headersAlreadySent()
|
||||
return
|
||||
}
|
||||
|
||||
debug('pipe "%s"', path)
|
||||
|
||||
// set header fields
|
||||
this.setHeader(path, stat)
|
||||
|
||||
// set content-type
|
||||
this.type(path)
|
||||
|
||||
// conditional GET support
|
||||
if (this.isConditionalGET()) {
|
||||
if (this.isPreconditionFailure()) {
|
||||
this.error(412)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.isCachable() && this.isFresh()) {
|
||||
this.notModified()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// adjust len to start/end options
|
||||
len = Math.max(0, len - offset)
|
||||
if (options.end !== undefined) {
|
||||
var bytes = options.end - offset + 1
|
||||
if (len > bytes) len = bytes
|
||||
}
|
||||
|
||||
// Range support
|
||||
if (this._acceptRanges && BYTES_RANGE_REGEXP.test(ranges)) {
|
||||
// parse
|
||||
ranges = parseRange(len, ranges, {
|
||||
combine: true
|
||||
})
|
||||
|
||||
// If-Range support
|
||||
if (!this.isRangeFresh()) {
|
||||
debug('range stale')
|
||||
ranges = -2
|
||||
}
|
||||
|
||||
// unsatisfiable
|
||||
if (ranges === -1) {
|
||||
debug('range unsatisfiable')
|
||||
|
||||
// Content-Range
|
||||
res.setHeader('Content-Range', contentRange('bytes', len))
|
||||
|
||||
// 416 Requested Range Not Satisfiable
|
||||
return this.error(416, {
|
||||
headers: { 'Content-Range': res.getHeader('Content-Range') }
|
||||
})
|
||||
}
|
||||
|
||||
// valid (syntactically invalid/multiple ranges are treated as a regular response)
|
||||
if (ranges !== -2 && ranges.length === 1) {
|
||||
debug('range %j', ranges)
|
||||
|
||||
// Content-Range
|
||||
res.statusCode = 206
|
||||
res.setHeader('Content-Range', contentRange('bytes', len, ranges[0]))
|
||||
|
||||
// adjust for requested range
|
||||
offset += ranges[0].start
|
||||
len = ranges[0].end - ranges[0].start + 1
|
||||
}
|
||||
}
|
||||
|
||||
// clone options
|
||||
for (var prop in options) {
|
||||
opts[prop] = options[prop]
|
||||
}
|
||||
|
||||
// set read options
|
||||
opts.start = offset
|
||||
opts.end = Math.max(offset, offset + len - 1)
|
||||
|
||||
// content-length
|
||||
res.setHeader('Content-Length', len)
|
||||
|
||||
// HEAD support
|
||||
if (req.method === 'HEAD') {
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
|
||||
this.stream(path, opts)
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer file for `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
SendStream.prototype.sendFile = function sendFile (path) {
|
||||
var i = 0
|
||||
var self = this
|
||||
|
||||
debug('stat "%s"', path)
|
||||
fs.stat(path, function onstat (err, stat) {
|
||||
var pathEndsWithSep = path[path.length - 1] === sep
|
||||
if (err && err.code === 'ENOENT' && !extname(path) && !pathEndsWithSep) {
|
||||
// not found, check extensions
|
||||
return next(err)
|
||||
}
|
||||
if (err) return self.onStatError(err)
|
||||
if (stat.isDirectory()) return self.redirect(path)
|
||||
if (pathEndsWithSep) return self.error(404)
|
||||
self.emit('file', path, stat)
|
||||
self.send(path, stat)
|
||||
})
|
||||
|
||||
function next (err) {
|
||||
if (self._extensions.length <= i) {
|
||||
return err
|
||||
? self.onStatError(err)
|
||||
: self.error(404)
|
||||
}
|
||||
|
||||
var p = path + '.' + self._extensions[i++]
|
||||
|
||||
debug('stat "%s"', p)
|
||||
fs.stat(p, function (err, stat) {
|
||||
if (err) return next(err)
|
||||
if (stat.isDirectory()) return next()
|
||||
self.emit('file', p, stat)
|
||||
self.send(p, stat)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer index for `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
SendStream.prototype.sendIndex = function sendIndex (path) {
|
||||
var i = -1
|
||||
var self = this
|
||||
|
||||
function next (err) {
|
||||
if (++i >= self._index.length) {
|
||||
if (err) return self.onStatError(err)
|
||||
return self.error(404)
|
||||
}
|
||||
|
||||
var p = join(path, self._index[i])
|
||||
|
||||
debug('stat "%s"', p)
|
||||
fs.stat(p, function (err, stat) {
|
||||
if (err) return next(err)
|
||||
if (stat.isDirectory()) return next()
|
||||
self.emit('file', p, stat)
|
||||
self.send(p, stat)
|
||||
})
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream `path` to the response.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Object} options
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.stream = function stream (path, options) {
|
||||
var self = this
|
||||
var res = this.res
|
||||
|
||||
// pipe
|
||||
var stream = fs.createReadStream(path, options)
|
||||
this.emit('stream', stream)
|
||||
stream.pipe(res)
|
||||
|
||||
// cleanup
|
||||
function cleanup () {
|
||||
stream.destroy()
|
||||
}
|
||||
|
||||
// response finished, cleanup
|
||||
onFinished(res, cleanup)
|
||||
|
||||
// error handling
|
||||
stream.on('error', function onerror (err) {
|
||||
// clean up stream early
|
||||
cleanup()
|
||||
|
||||
// error
|
||||
self.onStatError(err)
|
||||
})
|
||||
|
||||
// end
|
||||
stream.on('end', function onend () {
|
||||
self.emit('end')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content-type based on `path`
|
||||
* if it hasn't been explicitly set.
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.type = function type (path) {
|
||||
var res = this.res
|
||||
|
||||
if (res.getHeader('Content-Type')) return
|
||||
|
||||
var ext = extname(path)
|
||||
var type = mime.contentType(ext) || 'application/octet-stream'
|
||||
|
||||
debug('content-type %s', type)
|
||||
res.setHeader('Content-Type', type)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set response header fields, most
|
||||
* fields may be pre-defined.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Object} stat
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SendStream.prototype.setHeader = function setHeader (path, stat) {
|
||||
var res = this.res
|
||||
|
||||
this.emit('headers', res, path, stat)
|
||||
|
||||
if (this._acceptRanges && !res.getHeader('Accept-Ranges')) {
|
||||
debug('accept ranges')
|
||||
res.setHeader('Accept-Ranges', 'bytes')
|
||||
}
|
||||
|
||||
if (this._cacheControl && !res.getHeader('Cache-Control')) {
|
||||
var cacheControl = 'public, max-age=' + Math.floor(this._maxage / 1000)
|
||||
|
||||
if (this._immutable) {
|
||||
cacheControl += ', immutable'
|
||||
}
|
||||
|
||||
debug('cache-control %s', cacheControl)
|
||||
res.setHeader('Cache-Control', cacheControl)
|
||||
}
|
||||
|
||||
if (this._lastModified && !res.getHeader('Last-Modified')) {
|
||||
var modified = stat.mtime.toUTCString()
|
||||
debug('modified %s', modified)
|
||||
res.setHeader('Last-Modified', modified)
|
||||
}
|
||||
|
||||
if (this._etag && !res.getHeader('ETag')) {
|
||||
var val = etag(stat)
|
||||
debug('etag %s', val)
|
||||
res.setHeader('ETag', val)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all headers from a response.
|
||||
*
|
||||
* @param {object} res
|
||||
* @private
|
||||
*/
|
||||
|
||||
function clearHeaders (res) {
|
||||
for (const header of res.getHeaderNames()) {
|
||||
res.removeHeader(header)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse all leading slashes into a single slash
|
||||
*
|
||||
* @param {string} str
|
||||
* @private
|
||||
*/
|
||||
function collapseLeadingSlashes (str) {
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str[i] !== '/') {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return i > 1
|
||||
? '/' + str.substr(i)
|
||||
: str
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if path parts contain a dotfile.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function containsDotFile (parts) {
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var part = parts[i]
|
||||
if (part.length > 1 && part[0] === '.') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Content-Range header.
|
||||
*
|
||||
* @param {string} type
|
||||
* @param {number} size
|
||||
* @param {array} [range]
|
||||
*/
|
||||
|
||||
function contentRange (type, size, range) {
|
||||
return type + ' ' + (range ? range.start + '-' + range.end : '*') + '/' + size
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a minimal HTML document.
|
||||
*
|
||||
* @param {string} title
|
||||
* @param {string} body
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createHtmlDocument (title, body) {
|
||||
return '<!DOCTYPE html>\n' +
|
||||
'<html lang="en">\n' +
|
||||
'<head>\n' +
|
||||
'<meta charset="utf-8">\n' +
|
||||
'<title>' + title + '</title>\n' +
|
||||
'</head>\n' +
|
||||
'<body>\n' +
|
||||
'<pre>' + body + '</pre>\n' +
|
||||
'</body>\n' +
|
||||
'</html>\n'
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a HttpError object from simple arguments.
|
||||
*
|
||||
* @param {number} status
|
||||
* @param {Error|object} err
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createHttpError (status, err) {
|
||||
if (!err) {
|
||||
return createError(status)
|
||||
}
|
||||
|
||||
return err instanceof Error
|
||||
? createError(status, err, { expose: false })
|
||||
: createError(status, err)
|
||||
}
|
||||
|
||||
/**
|
||||
* decodeURIComponent.
|
||||
*
|
||||
* Allows V8 to only deoptimize this fn instead of all
|
||||
* of send().
|
||||
*
|
||||
* @param {String} path
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function decode (path) {
|
||||
try {
|
||||
return decodeURIComponent(path)
|
||||
} catch (err) {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if emitter has listeners of a given type.
|
||||
*
|
||||
* The way to do this check is done three different ways in Node.js >= 0.10
|
||||
* so this consolidates them into a minimal set using instance methods.
|
||||
*
|
||||
* @param {EventEmitter} emitter
|
||||
* @param {string} type
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function hasListeners (emitter, type) {
|
||||
var count = typeof emitter.listenerCount !== 'function'
|
||||
? emitter.listeners(type).length
|
||||
: emitter.listenerCount(type)
|
||||
|
||||
return count > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize the index option into an array.
|
||||
*
|
||||
* @param {boolean|string|array} val
|
||||
* @param {string} name
|
||||
* @private
|
||||
*/
|
||||
|
||||
function normalizeList (val, name) {
|
||||
var list = [].concat(val || [])
|
||||
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (typeof list[i] !== 'string') {
|
||||
throw new TypeError(name + ' must be array of strings or false')
|
||||
}
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an HTTP Date into a number.
|
||||
*
|
||||
* @param {string} date
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseHttpDate (date) {
|
||||
var timestamp = date && Date.parse(date)
|
||||
|
||||
return typeof timestamp === 'number'
|
||||
? timestamp
|
||||
: NaN
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a HTTP token list.
|
||||
*
|
||||
* @param {string} str
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseTokenList (str) {
|
||||
var end = 0
|
||||
var list = []
|
||||
var start = 0
|
||||
|
||||
// gather tokens
|
||||
for (var i = 0, len = str.length; i < len; i++) {
|
||||
switch (str.charCodeAt(i)) {
|
||||
case 0x20: /* */
|
||||
if (start === end) {
|
||||
start = end = i + 1
|
||||
}
|
||||
break
|
||||
case 0x2c: /* , */
|
||||
if (start !== end) {
|
||||
list.push(str.substring(start, end))
|
||||
}
|
||||
start = end = i + 1
|
||||
break
|
||||
default:
|
||||
end = i + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// final token
|
||||
if (start !== end) {
|
||||
list.push(str.substring(start, end))
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an object of headers on a response.
|
||||
*
|
||||
* @param {object} res
|
||||
* @param {object} headers
|
||||
* @private
|
||||
*/
|
||||
|
||||
function setHeaders (res, headers) {
|
||||
var keys = Object.keys(headers)
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i]
|
||||
res.setHeader(key, headers[key])
|
||||
}
|
||||
}
|
||||
541
node_modules/send/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
541
node_modules/send/node_modules/mime-db/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,541 @@
|
||||
1.54.0 / 2025-03-17
|
||||
===================
|
||||
|
||||
* Update mime type for DCM format (#362)
|
||||
* mark application/octet-stream as compressible (#163)
|
||||
* Fix typo in application/x-zip-compressed mimetype (#359)
|
||||
* Add mime-type for Jupyter notebooks (#282)
|
||||
* Add Google Drive MIME types (#311)
|
||||
* Add .blend file type (#338)
|
||||
* Add support for the FBX file extension (#342)
|
||||
* Add Adobe DNG file (#340)
|
||||
* Add Procreate Brush and Brush Set file Types (#339)
|
||||
* Add support for Procreate Dreams (#341)
|
||||
* replace got with undici (#352)
|
||||
* Added extensions list for model/step (#293)
|
||||
* Add m4b as a type of audio/mp4 (#357)
|
||||
* windows 11 application/x-zip-compressed (#346)
|
||||
* add dotLottie mime type (#351)
|
||||
* Add some MS-related extensions and types (#336)
|
||||
|
||||
1.53.0 / 2024-07-12
|
||||
===================
|
||||
|
||||
* Add extension `.sql` to `application/sql`
|
||||
* Add extensions `.aac` and `.adts` to `audio/aac`
|
||||
* Add extensions `.js` and `.mjs` to `text/javascript`
|
||||
* Add extensions for `application/mp4` from IANA
|
||||
* Add extensions from IANA for more MIME types
|
||||
* Add Microsoft app installer types and extensions
|
||||
* Add new upstream MIME types
|
||||
* Fix extensions for `text/markdown` to match IANA
|
||||
* Remove extension `.mjs` from `application/javascript`
|
||||
* Remove obsolete MIME types from IANA data
|
||||
|
||||
1.52.0 / 2022-02-21
|
||||
===================
|
||||
|
||||
* Add extensions from IANA for more `image/*` types
|
||||
* Add extension `.asc` to `application/pgp-keys`
|
||||
* Add extensions to various XML types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.51.0 / 2021-11-08
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Mark `image/vnd.microsoft.icon` as compressible
|
||||
* Mark `image/vnd.ms-dds` as compressible
|
||||
|
||||
1.50.0 / 2021-09-15
|
||||
===================
|
||||
|
||||
* Add deprecated iWorks mime types and extensions
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.49.0 / 2021-07-26
|
||||
===================
|
||||
|
||||
* Add extension `.trig` to `application/trig`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.48.0 / 2021-05-30
|
||||
===================
|
||||
|
||||
* Add extension `.mvt` to `application/vnd.mapbox-vector-tile`
|
||||
* Add new upstream MIME types
|
||||
* Mark `text/yaml` as compressible
|
||||
|
||||
1.47.0 / 2021-04-01
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Remove ambiguous extensions from IANA for `application/*+xml` types
|
||||
* Update primary extension to `.es` for `application/ecmascript`
|
||||
|
||||
1.46.0 / 2021-02-13
|
||||
===================
|
||||
|
||||
* Add extension `.amr` to `audio/amr`
|
||||
* Add extension `.m4s` to `video/iso.segment`
|
||||
* Add extension `.opus` to `audio/ogg`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.45.0 / 2020-09-22
|
||||
===================
|
||||
|
||||
* Add `application/ubjson` with extension `.ubj`
|
||||
* Add `image/avif` with extension `.avif`
|
||||
* Add `image/ktx2` with extension `.ktx2`
|
||||
* Add extension `.dbf` to `application/vnd.dbf`
|
||||
* Add extension `.rar` to `application/vnd.rar`
|
||||
* Add extension `.td` to `application/urc-targetdesc+xml`
|
||||
* Add new upstream MIME types
|
||||
* Fix extension of `application/vnd.apple.keynote` to be `.key`
|
||||
|
||||
1.44.0 / 2020-04-22
|
||||
===================
|
||||
|
||||
* Add charsets from IANA
|
||||
* Add extension `.cjs` to `application/node`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.43.0 / 2020-01-05
|
||||
===================
|
||||
|
||||
* Add `application/x-keepass2` with extension `.kdbx`
|
||||
* Add extension `.mxmf` to `audio/mobile-xmf`
|
||||
* Add extensions from IANA for `application/*+xml` types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.42.0 / 2019-09-25
|
||||
===================
|
||||
|
||||
* Add `image/vnd.ms-dds` with extension `.dds`
|
||||
* Add new upstream MIME types
|
||||
* Remove compressible from `multipart/mixed`
|
||||
|
||||
1.41.0 / 2019-08-30
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add `application/toml` with extension `.toml`
|
||||
* Mark `font/ttf` as compressible
|
||||
|
||||
1.40.0 / 2019-04-20
|
||||
===================
|
||||
|
||||
* Add extensions from IANA for `model/*` types
|
||||
* Add `text/mdx` with extension `.mdx`
|
||||
|
||||
1.39.0 / 2019-04-04
|
||||
===================
|
||||
|
||||
* Add extensions `.siv` and `.sieve` to `application/sieve`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.38.0 / 2019-02-04
|
||||
===================
|
||||
|
||||
* Add extension `.nq` to `application/n-quads`
|
||||
* Add extension `.nt` to `application/n-triples`
|
||||
* Add new upstream MIME types
|
||||
* Mark `text/less` as compressible
|
||||
|
||||
1.37.0 / 2018-10-19
|
||||
===================
|
||||
|
||||
* Add extensions to HEIC image types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.36.0 / 2018-08-20
|
||||
===================
|
||||
|
||||
* Add Apple file extensions from IANA
|
||||
* Add extensions from IANA for `image/*` types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.35.0 / 2018-07-15
|
||||
===================
|
||||
|
||||
* Add extension `.owl` to `application/rdf+xml`
|
||||
* Add new upstream MIME types
|
||||
- Removes extension `.woff` from `application/font-woff`
|
||||
|
||||
1.34.0 / 2018-06-03
|
||||
===================
|
||||
|
||||
* Add extension `.csl` to `application/vnd.citationstyles.style+xml`
|
||||
* Add extension `.es` to `application/ecmascript`
|
||||
* Add new upstream MIME types
|
||||
* Add `UTF-8` as default charset for `text/turtle`
|
||||
* Mark all XML-derived types as compressible
|
||||
|
||||
1.33.0 / 2018-02-15
|
||||
===================
|
||||
|
||||
* Add extensions from IANA for `message/*` types
|
||||
* Add new upstream MIME types
|
||||
* Fix some incorrect OOXML types
|
||||
* Remove `application/font-woff2`
|
||||
|
||||
1.32.0 / 2017-11-29
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Update `text/hjson` to registered `application/hjson`
|
||||
* Add `text/shex` with extension `.shex`
|
||||
|
||||
1.31.0 / 2017-10-25
|
||||
===================
|
||||
|
||||
* Add `application/raml+yaml` with extension `.raml`
|
||||
* Add `application/wasm` with extension `.wasm`
|
||||
* Add new `font` type from IANA
|
||||
* Add new upstream font extensions
|
||||
* Add new upstream MIME types
|
||||
* Add extensions for JPEG-2000 images
|
||||
|
||||
1.30.0 / 2017-08-27
|
||||
===================
|
||||
|
||||
* Add `application/vnd.ms-outlook`
|
||||
* Add `application/x-arj`
|
||||
* Add extension `.mjs` to `application/javascript`
|
||||
* Add glTF types and extensions
|
||||
* Add new upstream MIME types
|
||||
* Add `text/x-org`
|
||||
* Add VirtualBox MIME types
|
||||
* Fix `source` records for `video/*` types that are IANA
|
||||
* Update `font/opentype` to registered `font/otf`
|
||||
|
||||
1.29.0 / 2017-07-10
|
||||
===================
|
||||
|
||||
* Add `application/fido.trusted-apps+json`
|
||||
* Add extension `.wadl` to `application/vnd.sun.wadl+xml`
|
||||
* Add new upstream MIME types
|
||||
* Add `UTF-8` as default charset for `text/css`
|
||||
|
||||
1.28.0 / 2017-05-14
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.gz` to `application/gzip`
|
||||
* Update extensions `.md` and `.markdown` to be `text/markdown`
|
||||
|
||||
1.27.0 / 2017-03-16
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add `image/apng` with extension `.apng`
|
||||
|
||||
1.26.0 / 2017-01-14
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.geojson` to `application/geo+json`
|
||||
|
||||
1.25.0 / 2016-11-11
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.24.0 / 2016-09-18
|
||||
===================
|
||||
|
||||
* Add `audio/mp3`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.23.0 / 2016-05-01
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
* Add extension `.3gpp` to `audio/3gpp`
|
||||
|
||||
1.22.0 / 2016-02-15
|
||||
===================
|
||||
|
||||
* Add `text/slim`
|
||||
* Add extension `.rng` to `application/xml`
|
||||
* Add new upstream MIME types
|
||||
* Fix extension of `application/dash+xml` to be `.mpd`
|
||||
* Update primary extension to `.m4a` for `audio/mp4`
|
||||
|
||||
1.21.0 / 2016-01-06
|
||||
===================
|
||||
|
||||
* Add Google document types
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.20.0 / 2015-11-10
|
||||
===================
|
||||
|
||||
* Add `text/x-suse-ymp`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.19.0 / 2015-09-17
|
||||
===================
|
||||
|
||||
* Add `application/vnd.apple.pkpass`
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.18.0 / 2015-09-03
|
||||
===================
|
||||
|
||||
* Add new upstream MIME types
|
||||
|
||||
1.17.0 / 2015-08-13
|
||||
===================
|
||||
|
||||
* Add `application/x-msdos-program`
|
||||
* Add `audio/g711-0`
|
||||
* Add `image/vnd.mozilla.apng`
|
||||
* Add extension `.exe` to `application/x-msdos-program`
|
||||
|
||||
1.16.0 / 2015-07-29
|
||||
===================
|
||||
|
||||
* Add `application/vnd.uri-map`
|
||||
|
||||
1.15.0 / 2015-07-13
|
||||
===================
|
||||
|
||||
* Add `application/x-httpd-php`
|
||||
|
||||
1.14.0 / 2015-06-25
|
||||
===================
|
||||
|
||||
* Add `application/scim+json`
|
||||
* Add `application/vnd.3gpp.ussd+xml`
|
||||
* Add `application/vnd.biopax.rdf+xml`
|
||||
* Add `text/x-processing`
|
||||
|
||||
1.13.0 / 2015-06-07
|
||||
===================
|
||||
|
||||
* Add nginx as a source
|
||||
* Add `application/x-cocoa`
|
||||
* Add `application/x-java-archive-diff`
|
||||
* Add `application/x-makeself`
|
||||
* Add `application/x-perl`
|
||||
* Add `application/x-pilot`
|
||||
* Add `application/x-redhat-package-manager`
|
||||
* Add `application/x-sea`
|
||||
* Add `audio/x-m4a`
|
||||
* Add `audio/x-realaudio`
|
||||
* Add `image/x-jng`
|
||||
* Add `text/mathml`
|
||||
|
||||
1.12.0 / 2015-06-05
|
||||
===================
|
||||
|
||||
* Add `application/bdoc`
|
||||
* Add `application/vnd.hyperdrive+json`
|
||||
* Add `application/x-bdoc`
|
||||
* Add extension `.rtf` to `text/rtf`
|
||||
|
||||
1.11.0 / 2015-05-31
|
||||
===================
|
||||
|
||||
* Add `audio/wav`
|
||||
* Add `audio/wave`
|
||||
* Add extension `.litcoffee` to `text/coffeescript`
|
||||
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
|
||||
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
|
||||
|
||||
1.10.0 / 2015-05-19
|
||||
===================
|
||||
|
||||
* Add `application/vnd.balsamiq.bmpr`
|
||||
* Add `application/vnd.microsoft.portable-executable`
|
||||
* Add `application/x-ns-proxy-autoconfig`
|
||||
|
||||
1.9.1 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Remove `.json` extension from `application/manifest+json`
|
||||
- This is causing bugs downstream
|
||||
|
||||
1.9.0 / 2015-04-19
|
||||
==================
|
||||
|
||||
* Add `application/manifest+json`
|
||||
* Add `application/vnd.micro+json`
|
||||
* Add `image/vnd.zbrush.pcx`
|
||||
* Add `image/x-ms-bmp`
|
||||
|
||||
1.8.0 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Add `application/vnd.citationstyles.style+xml`
|
||||
* Add `application/vnd.fastcopy-disk-image`
|
||||
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
|
||||
* Add extension `.jsonld` to `application/ld+json`
|
||||
|
||||
1.7.0 / 2015-02-08
|
||||
==================
|
||||
|
||||
* Add `application/vnd.gerber`
|
||||
* Add `application/vnd.msa-disk-image`
|
||||
|
||||
1.6.1 / 2015-02-05
|
||||
==================
|
||||
|
||||
* Community extensions ownership transferred from `node-mime`
|
||||
|
||||
1.6.0 / 2015-01-29
|
||||
==================
|
||||
|
||||
* Add `application/jose`
|
||||
* Add `application/jose+json`
|
||||
* Add `application/json-seq`
|
||||
* Add `application/jwk+json`
|
||||
* Add `application/jwk-set+json`
|
||||
* Add `application/jwt`
|
||||
* Add `application/rdap+json`
|
||||
* Add `application/vnd.gov.sk.e-form+xml`
|
||||
* Add `application/vnd.ims.imsccv1p3`
|
||||
|
||||
1.5.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* Add `application/vnd.oracle.resource+json`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/mbox+xml`
|
||||
- `application/oscp-response`
|
||||
- `application/vwg-multiplexed`
|
||||
- `audio/g721`
|
||||
|
||||
1.4.0 / 2014-12-21
|
||||
==================
|
||||
|
||||
* Add `application/vnd.ims.imsccv1p2`
|
||||
* Fix various invalid MIME type entries
|
||||
- `application/vnd-acucobol`
|
||||
- `application/vnd-curl`
|
||||
- `application/vnd-dart`
|
||||
- `application/vnd-dxr`
|
||||
- `application/vnd-fdf`
|
||||
- `application/vnd-mif`
|
||||
- `application/vnd-sema`
|
||||
- `application/vnd-wap-wmlc`
|
||||
- `application/vnd.adobe.flash-movie`
|
||||
- `application/vnd.dece-zip`
|
||||
- `application/vnd.dvb_service`
|
||||
- `application/vnd.micrografx-igx`
|
||||
- `application/vnd.sealed-doc`
|
||||
- `application/vnd.sealed-eml`
|
||||
- `application/vnd.sealed-mht`
|
||||
- `application/vnd.sealed-ppt`
|
||||
- `application/vnd.sealed-tiff`
|
||||
- `application/vnd.sealed-xls`
|
||||
- `application/vnd.sealedmedia.softseal-html`
|
||||
- `application/vnd.sealedmedia.softseal-pdf`
|
||||
- `application/vnd.wap-slc`
|
||||
- `application/vnd.wap-wbxml`
|
||||
- `audio/vnd.sealedmedia.softseal-mpeg`
|
||||
- `image/vnd-djvu`
|
||||
- `image/vnd-svf`
|
||||
- `image/vnd-wap-wbmp`
|
||||
- `image/vnd.sealed-png`
|
||||
- `image/vnd.sealedmedia.softseal-gif`
|
||||
- `image/vnd.sealedmedia.softseal-jpg`
|
||||
- `model/vnd-dwf`
|
||||
- `model/vnd.parasolid.transmit-binary`
|
||||
- `model/vnd.parasolid.transmit-text`
|
||||
- `text/vnd-a`
|
||||
- `text/vnd-curl`
|
||||
- `text/vnd.wap-wml`
|
||||
* Remove example template MIME types
|
||||
- `application/example`
|
||||
- `audio/example`
|
||||
- `image/example`
|
||||
- `message/example`
|
||||
- `model/example`
|
||||
- `multipart/example`
|
||||
- `text/example`
|
||||
- `video/example`
|
||||
|
||||
1.3.1 / 2014-12-16
|
||||
==================
|
||||
|
||||
* Fix missing extensions
|
||||
- `application/json5`
|
||||
- `text/hjson`
|
||||
|
||||
1.3.0 / 2014-12-07
|
||||
==================
|
||||
|
||||
* Add `application/a2l`
|
||||
* Add `application/aml`
|
||||
* Add `application/atfx`
|
||||
* Add `application/atxml`
|
||||
* Add `application/cdfx+xml`
|
||||
* Add `application/dii`
|
||||
* Add `application/json5`
|
||||
* Add `application/lxf`
|
||||
* Add `application/mf4`
|
||||
* Add `application/vnd.apache.thrift.compact`
|
||||
* Add `application/vnd.apache.thrift.json`
|
||||
* Add `application/vnd.coffeescript`
|
||||
* Add `application/vnd.enphase.envoy`
|
||||
* Add `application/vnd.ims.imsccv1p1`
|
||||
* Add `text/csv-schema`
|
||||
* Add `text/hjson`
|
||||
* Add `text/markdown`
|
||||
* Add `text/yaml`
|
||||
|
||||
1.2.0 / 2014-11-09
|
||||
==================
|
||||
|
||||
* Add `application/cea`
|
||||
* Add `application/dit`
|
||||
* Add `application/vnd.gov.sk.e-form+zip`
|
||||
* Add `application/vnd.tmd.mediaflex.api+xml`
|
||||
* Type `application/epub+zip` is now IANA-registered
|
||||
|
||||
1.1.2 / 2014-10-23
|
||||
==================
|
||||
|
||||
* Rebuild database for `application/x-www-form-urlencoded` change
|
||||
|
||||
1.1.1 / 2014-10-20
|
||||
==================
|
||||
|
||||
* Mark `application/x-www-form-urlencoded` as compressible.
|
||||
|
||||
1.1.0 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Add `application/font-woff2`
|
||||
|
||||
1.0.3 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Fix engine requirement in package
|
||||
|
||||
1.0.2 / 2014-09-25
|
||||
==================
|
||||
|
||||
* Add `application/coap-group+json`
|
||||
* Add `application/dcd`
|
||||
* Add `application/vnd.apache.thrift.binary`
|
||||
* Add `image/vnd.tencent.tap`
|
||||
* Mark all JSON-derived types as compressible
|
||||
* Update `text/vtt` data
|
||||
|
||||
1.0.1 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Fix extension ordering
|
||||
|
||||
1.0.0 / 2014-08-30
|
||||
==================
|
||||
|
||||
* Add `application/atf`
|
||||
* Add `application/merge-patch+json`
|
||||
* Add `multipart/x-mixed-replace`
|
||||
* Add `source: 'apache'` metadata
|
||||
* Add `source: 'iana'` metadata
|
||||
* Remove badly-assumed charset data
|
||||
23
node_modules/send/node_modules/mime-db/LICENSE
generated
vendored
Normal file
23
node_modules/send/node_modules/mime-db/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015-2022 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.
|
||||
109
node_modules/send/node_modules/mime-db/README.md
generated
vendored
Normal file
109
node_modules/send/node_modules/mime-db/README.md
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# mime-db
|
||||
|
||||
[![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]
|
||||
|
||||
This is a large database of mime types and information about them.
|
||||
It consists of a single, public JSON file and does not include any logic,
|
||||
allowing it to remain as un-opinionated as possible with an API.
|
||||
It aggregates data from the following sources:
|
||||
|
||||
- https://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
- https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
||||
- https://hg.nginx.org/nginx/raw-file/default/conf/mime.types
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install mime-db
|
||||
```
|
||||
|
||||
### Database Download
|
||||
|
||||
If you intend to use this in a web browser, you can conveniently access the JSON file via [jsDelivr](https://www.jsdelivr.com/), a popular CDN (Content Delivery Network). To ensure stability and compatibility, it is advisable to specify [a release tag](https://github.com/jshttp/mime-db/tags) instead of using the 'master' branch. This is because the JSON file's format might change in future updates, and relying on a specific release tag will prevent potential issues arising from these changes.
|
||||
|
||||
```
|
||||
https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var db = require('mime-db')
|
||||
|
||||
// grab data on .js files
|
||||
var data = db['application/javascript']
|
||||
```
|
||||
|
||||
## Data Structure
|
||||
|
||||
The JSON file is a map lookup for lowercased mime types.
|
||||
Each mime type has the following properties:
|
||||
|
||||
- `.source` - where the mime type is defined.
|
||||
If not set, it's probably a custom media type.
|
||||
- `apache` - [Apache common media types](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
|
||||
- `iana` - [IANA-defined media types](https://www.iana.org/assignments/media-types/media-types.xhtml)
|
||||
- `nginx` - [nginx media types](https://hg.nginx.org/nginx/raw-file/default/conf/mime.types)
|
||||
- `.extensions[]` - known extensions associated with this mime type.
|
||||
- `.compressible` - whether a file of this type can be gzipped.
|
||||
- `.charset` - the default charset associated with this type, if any.
|
||||
|
||||
If unknown, every property could be `undefined`.
|
||||
|
||||
## Note on MIME Type Data and Semver
|
||||
|
||||
This package considers the programmatic api as the semver compatibility. This means the MIME type resolution is *not* considered
|
||||
in the semver bumps. This means that if you want to pin your `mime-db` data you will need to do it in your application. While
|
||||
this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is a breaking change.
|
||||
|
||||
## Contributing
|
||||
|
||||
The primary way to contribute to this database is by updating the data in
|
||||
one of the upstream sources. The database is updated from the upstreams
|
||||
periodically and will pull in any changes.
|
||||
|
||||
### Registering Media Types
|
||||
|
||||
The best way to get new media types included in this library is to register
|
||||
them with the IANA. The community registration procedure is outlined in
|
||||
[RFC 6838 section 5](https://tools.ietf.org/html/rfc6838#section-5). Types
|
||||
registered with the IANA are automatically pulled into this library.
|
||||
|
||||
### Direct Inclusion
|
||||
|
||||
If that is not possible / feasible, they can be added directly here as a
|
||||
"custom" type. To do this, it is required to have a primary source that
|
||||
definitively lists the media type. If an extension is going to be listed as
|
||||
associated with this media type, the source must definitively link the
|
||||
media type and extension as well.
|
||||
|
||||
To edit the database, only make PRs against `src/custom-types.json` or
|
||||
`src/custom-suffix.json`.
|
||||
|
||||
The `src/custom-types.json` file is a JSON object with the MIME type as the
|
||||
keys and the values being an object with the following keys:
|
||||
|
||||
- `compressible` - leave out if you don't know, otherwise `true`/`false` to
|
||||
indicate whether the data represented by the type is typically compressible.
|
||||
- `extensions` - include an array of file extensions that are associated with
|
||||
the type.
|
||||
- `notes` - human-readable notes about the type, typically what the type is.
|
||||
- `sources` - include an array of URLs of where the MIME type and the associated
|
||||
extensions are sourced from. This needs to be a [primary source](https://en.wikipedia.org/wiki/Primary_source);
|
||||
links to type aggregating sites and Wikipedia are _not acceptable_.
|
||||
|
||||
To update the build, run `npm run build`.
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/mime-db/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/mime-db/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
|
||||
[node-image]: https://badgen.net/npm/node/mime-db
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/mime-db
|
||||
[npm-url]: https://npmjs.org/package/mime-db
|
||||
[npm-version-image]: https://badgen.net/npm/v/mime-db
|
||||
9342
node_modules/send/node_modules/mime-db/db.json
generated
vendored
Normal file
9342
node_modules/send/node_modules/mime-db/db.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12
node_modules/send/node_modules/mime-db/index.js
generated
vendored
Normal file
12
node_modules/send/node_modules/mime-db/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/*!
|
||||
* mime-db
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = require('./db.json')
|
||||
56
node_modules/send/node_modules/mime-db/package.json
generated
vendored
Normal file
56
node_modules/send/node_modules/mime-db/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "mime-db",
|
||||
"description": "Media Type Database",
|
||||
"version": "1.54.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
|
||||
"Robert Kieffer <robert@broofa.com> (http://github.com/broofa)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"db",
|
||||
"type",
|
||||
"types",
|
||||
"database",
|
||||
"charset",
|
||||
"charsets"
|
||||
],
|
||||
"repository": "jshttp/mime-db",
|
||||
"devDependencies": {
|
||||
"csv-parse": "4.16.3",
|
||||
"eslint": "8.32.0",
|
||||
"eslint-config-standard": "15.0.1",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
"eslint-plugin-markdown": "3.0.0",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "6.1.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"media-typer": "1.1.0",
|
||||
"mocha": "10.2.0",
|
||||
"nyc": "15.1.0",
|
||||
"stream-to-array": "2.3.0",
|
||||
"undici": "7.1.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"db.json",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build",
|
||||
"fetch": "node scripts/fetch-apache && node scripts/fetch-iana && node scripts/fetch-nginx",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks test/",
|
||||
"test-ci": "nyc --reporter=lcovonly --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"
|
||||
}
|
||||
}
|
||||
428
node_modules/send/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
428
node_modules/send/node_modules/mime-types/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
3.0.2 / 2025-11-20
|
||||
===================
|
||||
|
||||
* Fix: update JSDoc to reflect that functions return only `false` or `string`, not `boolean|string`.
|
||||
* Fix: refined mime-score logic so `.mp4` resolves correctly
|
||||
* Fix:reflect the current Node.js version supported to ≥ 18 (See 3.0.0 for more details).
|
||||
|
||||
3.0.1 / 2025-03-26
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.54.0
|
||||
|
||||
3.0.0 / 2024-08-31
|
||||
===================
|
||||
|
||||
* Drop support for node <18
|
||||
* deps: mime-db@1.53.0
|
||||
* resolve extension conflicts with mime-score (#119)
|
||||
* asc -> application/pgp-signature is now application/pgp-keys
|
||||
* mpp -> application/vnd.ms-project is now application/dash-patch+xml
|
||||
* ac -> application/vnd.nokia.n-gage.ac+xml is now application/pkix-attr-cert
|
||||
* bdoc -> application/x-bdoc is now application/bdoc
|
||||
* wmz -> application/x-msmetafile is now application/x-ms-wmz
|
||||
* xsl -> application/xslt+xml is now application/xml
|
||||
* wav -> audio/wave is now audio/wav
|
||||
* rtf -> text/rtf is now application/rtf
|
||||
* xml -> text/xml is now application/xml
|
||||
* mp4 -> video/mp4 is now application/mp4
|
||||
* mpg4 -> video/mp4 is now application/mp4
|
||||
|
||||
|
||||
2.1.35 / 2022-03-12
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.52.0
|
||||
- Add extensions from IANA for more `image/*` types
|
||||
- Add extension `.asc` to `application/pgp-keys`
|
||||
- Add extensions to various XML types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.34 / 2021-11-08
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.51.0
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.33 / 2021-10-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.50.0
|
||||
- Add deprecated iWorks mime types and extensions
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.32 / 2021-07-27
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.49.0
|
||||
- Add extension `.trig` to `application/trig`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.31 / 2021-06-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.48.0
|
||||
- Add extension `.mvt` to `application/vnd.mapbox-vector-tile`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.30 / 2021-04-02
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.47.0
|
||||
- Add extension `.amr` to `audio/amr`
|
||||
- Remove ambigious extensions from IANA for `application/*+xml` types
|
||||
- Update primary extension to `.es` for `application/ecmascript`
|
||||
|
||||
2.1.29 / 2021-02-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.46.0
|
||||
- Add extension `.amr` to `audio/amr`
|
||||
- Add extension `.m4s` to `video/iso.segment`
|
||||
- Add extension `.opus` to `audio/ogg`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.28 / 2021-01-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.45.0
|
||||
- Add `application/ubjson` with extension `.ubj`
|
||||
- Add `image/avif` with extension `.avif`
|
||||
- Add `image/ktx2` with extension `.ktx2`
|
||||
- Add extension `.dbf` to `application/vnd.dbf`
|
||||
- Add extension `.rar` to `application/vnd.rar`
|
||||
- Add extension `.td` to `application/urc-targetdesc+xml`
|
||||
- Add new upstream MIME types
|
||||
- Fix extension of `application/vnd.apple.keynote` to be `.key`
|
||||
|
||||
2.1.27 / 2020-04-23
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.44.0
|
||||
- Add charsets from IANA
|
||||
- Add extension `.cjs` to `application/node`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.26 / 2020-01-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.43.0
|
||||
- Add `application/x-keepass2` with extension `.kdbx`
|
||||
- Add extension `.mxmf` to `audio/mobile-xmf`
|
||||
- Add extensions from IANA for `application/*+xml` types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.25 / 2019-11-12
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.42.0
|
||||
- Add new upstream MIME types
|
||||
- Add `application/toml` with extension `.toml`
|
||||
- Add `image/vnd.ms-dds` with extension `.dds`
|
||||
|
||||
2.1.24 / 2019-04-20
|
||||
===================
|
||||
|
||||
* deps: mime-db@1.40.0
|
||||
- Add extensions from IANA for `model/*` types
|
||||
- Add `text/mdx` with extension `.mdx`
|
||||
|
||||
2.1.23 / 2019-04-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.39.0
|
||||
- Add extensions `.siv` and `.sieve` to `application/sieve`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.22 / 2019-02-14
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.38.0
|
||||
- Add extension `.nq` to `application/n-quads`
|
||||
- Add extension `.nt` to `application/n-triples`
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.21 / 2018-10-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.37.0
|
||||
- Add extensions to HEIC image types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.20 / 2018-08-26
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.36.0
|
||||
- Add Apple file extensions from IANA
|
||||
- Add extensions from IANA for `image/*` types
|
||||
- Add new upstream MIME types
|
||||
|
||||
2.1.19 / 2018-07-17
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.35.0
|
||||
- Add extension `.csl` to `application/vnd.citationstyles.style+xml`
|
||||
- Add extension `.es` to `application/ecmascript`
|
||||
- Add extension `.owl` to `application/rdf+xml`
|
||||
- Add new upstream MIME types
|
||||
- Add UTF-8 as default charset for `text/turtle`
|
||||
|
||||
2.1.18 / 2018-02-16
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.33.0
|
||||
- Add `application/raml+yaml` with extension `.raml`
|
||||
- Add `application/wasm` with extension `.wasm`
|
||||
- Add `text/shex` with extension `.shex`
|
||||
- Add extensions for JPEG-2000 images
|
||||
- Add extensions from IANA for `message/*` types
|
||||
- Add new upstream MIME types
|
||||
- Update font MIME types
|
||||
- Update `text/hjson` to registered `application/hjson`
|
||||
|
||||
2.1.17 / 2017-09-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.30.0
|
||||
- Add `application/vnd.ms-outlook`
|
||||
- Add `application/x-arj`
|
||||
- Add extension `.mjs` to `application/javascript`
|
||||
- Add glTF types and extensions
|
||||
- Add new upstream MIME types
|
||||
- Add `text/x-org`
|
||||
- Add VirtualBox MIME types
|
||||
- Fix `source` records for `video/*` types that are IANA
|
||||
- Update `font/opentype` to registered `font/otf`
|
||||
|
||||
2.1.16 / 2017-07-24
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.29.0
|
||||
- Add `application/fido.trusted-apps+json`
|
||||
- Add extension `.wadl` to `application/vnd.sun.wadl+xml`
|
||||
- Add extension `.gz` to `application/gzip`
|
||||
- Add new upstream MIME types
|
||||
- Update extensions `.md` and `.markdown` to be `text/markdown`
|
||||
|
||||
2.1.15 / 2017-03-23
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.27.0
|
||||
- Add new mime types
|
||||
- Add `image/apng`
|
||||
|
||||
2.1.14 / 2017-01-14
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.26.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.13 / 2016-11-18
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.25.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.12 / 2016-09-18
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.24.0
|
||||
- Add new mime types
|
||||
- Add `audio/mp3`
|
||||
|
||||
2.1.11 / 2016-05-01
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.23.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.10 / 2016-02-15
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.22.0
|
||||
- Add new mime types
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
|
||||
2.1.9 / 2016-01-06
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.21.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.8 / 2015-11-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.20.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.7 / 2015-09-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.19.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.6 / 2015-09-03
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.18.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.5 / 2015-08-20
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.17.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.4 / 2015-07-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.16.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.3 / 2015-07-13
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.15.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.2 / 2015-06-25
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.14.0
|
||||
- Add new mime types
|
||||
|
||||
2.1.1 / 2015-06-08
|
||||
==================
|
||||
|
||||
* perf: fix deopt during mapping
|
||||
|
||||
2.1.0 / 2015-06-07
|
||||
==================
|
||||
|
||||
* Fix incorrectly treating extension-less file name as extension
|
||||
- i.e. `'path/to/json'` will no longer return `application/json`
|
||||
* Fix `.charset(type)` to accept parameters
|
||||
* Fix `.charset(type)` to match case-insensitive
|
||||
* Improve generation of extension to MIME mapping
|
||||
* Refactor internals for readability and no argument reassignment
|
||||
* Prefer `application/*` MIME types from the same source
|
||||
* Prefer any type over `application/octet-stream`
|
||||
* deps: mime-db@~1.13.0
|
||||
- Add nginx as a source
|
||||
- Add new mime types
|
||||
|
||||
2.0.14 / 2015-06-06
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.12.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.13 / 2015-05-31
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.11.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.12 / 2015-05-19
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.10.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.11 / 2015-05-05
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.9.1
|
||||
- Add new mime types
|
||||
|
||||
2.0.10 / 2015-03-13
|
||||
===================
|
||||
|
||||
* deps: mime-db@~1.8.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.9 / 2015-02-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.7.0
|
||||
- Add new mime types
|
||||
- Community extensions ownership transferred from `node-mime`
|
||||
|
||||
2.0.8 / 2015-01-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.6.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.7 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.5.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
|
||||
2.0.6 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.4.0
|
||||
- Add new mime types
|
||||
- Fix various invalid MIME type entries
|
||||
- Remove example template MIME types
|
||||
|
||||
2.0.5 / 2014-12-29
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.1
|
||||
- Fix missing extensions
|
||||
|
||||
2.0.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.3.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.2.0
|
||||
- Add new mime types
|
||||
|
||||
2.0.2 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-db@~1.1.0
|
||||
- Add new mime types
|
||||
- Update charsets
|
||||
|
||||
2.0.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
|
||||
2.0.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* Use `mime-db`
|
||||
* Remove `.define()`
|
||||
|
||||
1.0.2 / 2014-08-04
|
||||
==================
|
||||
|
||||
* Set charset=utf-8 for `text/javascript`
|
||||
|
||||
1.0.1 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Add `text/jsx` type
|
||||
|
||||
1.0.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Return `false` for unknown types
|
||||
* Set charset=utf-8 for `application/json`
|
||||
|
||||
0.1.0 / 2014-05-02
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/send/node_modules/mime-types/LICENSE
generated
vendored
Normal file
23
node_modules/send/node_modules/mime-types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 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.
|
||||
126
node_modules/send/node_modules/mime-types/README.md
generated
vendored
Normal file
126
node_modules/send/node_modules/mime-types/README.md
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
# mime-types
|
||||
|
||||
[![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]
|
||||
|
||||
The ultimate javascript content-type utility.
|
||||
|
||||
Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except:
|
||||
|
||||
- __No fallbacks.__ Instead of naively returning the first available type,
|
||||
`mime-types` simply returns `false`, so do
|
||||
`var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
|
||||
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
|
||||
- No `.define()` functionality
|
||||
- Bug fixes for `.lookup(path)`
|
||||
|
||||
Otherwise, the API is compatible with `mime` 1.x.
|
||||
|
||||
## 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 mime-types
|
||||
```
|
||||
|
||||
## Note on MIME Type Data and Semver
|
||||
|
||||
This package considers the programmatic api as the semver compatibility. Additionally, the package which provides the MIME data
|
||||
for this package (`mime-db`) *also* considers it's programmatic api as the semver contract. This means the MIME type resolution is *not* considered
|
||||
in the semver bumps.
|
||||
|
||||
In the past the version of `mime-db` was pinned to give two decision points when adopting MIME data changes. This is no longer true. We still update the
|
||||
`mime-db` package here as a `minor` release when necessary, but will use a `^` range going forward. This means that if you want to pin your `mime-db` data
|
||||
you will need to do it in your application. While this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is
|
||||
a breaking change.
|
||||
|
||||
If you wish to pin your `mime-db` version you can do that with overrides via your package manager of choice. See their documentation for how to correctly configure that.
|
||||
|
||||
## Adding Types
|
||||
|
||||
All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db),
|
||||
so open a PR there if you'd like to add mime types.
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var mime = require('mime-types')
|
||||
```
|
||||
|
||||
All functions return `false` if input is invalid or not found.
|
||||
|
||||
### mime.lookup(path)
|
||||
|
||||
Lookup the content-type associated with a file.
|
||||
|
||||
```js
|
||||
mime.lookup('json') // 'application/json'
|
||||
mime.lookup('.md') // 'text/markdown'
|
||||
mime.lookup('file.html') // 'text/html'
|
||||
mime.lookup('folder/file.js') // 'application/javascript'
|
||||
mime.lookup('folder/.htaccess') // false
|
||||
|
||||
mime.lookup('cats') // false
|
||||
```
|
||||
|
||||
### mime.contentType(type)
|
||||
|
||||
Create a full content-type header given a content-type or extension.
|
||||
When given an extension, `mime.lookup` is used to get the matching
|
||||
content-type, otherwise the given content-type is used. Then if the
|
||||
content-type does not already have a `charset` parameter, `mime.charset`
|
||||
is used to get the default charset and add to the returned content-type.
|
||||
|
||||
```js
|
||||
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
|
||||
mime.contentType('file.json') // 'application/json; charset=utf-8'
|
||||
mime.contentType('text/html') // 'text/html; charset=utf-8'
|
||||
mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1'
|
||||
|
||||
// from a full path
|
||||
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
|
||||
```
|
||||
|
||||
### mime.extension(type)
|
||||
|
||||
Get the default extension for a content-type.
|
||||
|
||||
```js
|
||||
mime.extension('application/octet-stream') // 'bin'
|
||||
```
|
||||
|
||||
### mime.charset(type)
|
||||
|
||||
Lookup the implied default charset of a content-type.
|
||||
|
||||
```js
|
||||
mime.charset('text/markdown') // 'UTF-8'
|
||||
```
|
||||
|
||||
### var type = mime.types[extension]
|
||||
|
||||
A map of content-types by extension.
|
||||
|
||||
### [extensions...] = mime.extensions[type]
|
||||
|
||||
A map of extensions by content-type.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/mime-types/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/mime-types
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/mime-types
|
||||
[npm-url]: https://npmjs.org/package/mime-types
|
||||
[npm-version-image]: https://badgen.net/npm/v/mime-types
|
||||
211
node_modules/send/node_modules/mime-types/index.js
generated
vendored
Normal file
211
node_modules/send/node_modules/mime-types/index.js
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
/*!
|
||||
* mime-types
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var db = require('mime-db')
|
||||
var extname = require('path').extname
|
||||
var mimeScore = require('./mimeScore')
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
|
||||
var TEXT_TYPE_REGEXP = /^text\//i
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.charset = charset
|
||||
exports.charsets = { lookup: charset }
|
||||
exports.contentType = contentType
|
||||
exports.extension = extension
|
||||
exports.extensions = Object.create(null)
|
||||
exports.lookup = lookup
|
||||
exports.types = Object.create(null)
|
||||
exports._extensionConflicts = []
|
||||
|
||||
// Populate the extensions/types maps
|
||||
populateMaps(exports.extensions, exports.types)
|
||||
|
||||
/**
|
||||
* Get the default charset for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {false|string}
|
||||
*/
|
||||
|
||||
function charset (type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
||||
var mime = match && db[match[1].toLowerCase()]
|
||||
|
||||
if (mime && mime.charset) {
|
||||
return mime.charset
|
||||
}
|
||||
|
||||
// default text/* to utf-8
|
||||
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
||||
return 'UTF-8'
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a full Content-Type header given a MIME type or extension.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {false|string}
|
||||
*/
|
||||
|
||||
function contentType (str) {
|
||||
// TODO: should this even be in this module?
|
||||
if (!str || typeof str !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str
|
||||
|
||||
if (!mime) {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use content-type or other module
|
||||
if (mime.indexOf('charset') === -1) {
|
||||
var charset = exports.charset(mime)
|
||||
if (charset) mime += '; charset=' + charset.toLowerCase()
|
||||
}
|
||||
|
||||
return mime
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default extension for a MIME type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @return {false|string}
|
||||
*/
|
||||
|
||||
function extension (type) {
|
||||
if (!type || typeof type !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: use media-typer
|
||||
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
||||
|
||||
// get extensions
|
||||
var exts = match && exports.extensions[match[1].toLowerCase()]
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exts[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup the MIME type for a file path/extension.
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {false|string}
|
||||
*/
|
||||
|
||||
function lookup (path) {
|
||||
if (!path || typeof path !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
// get the extension ("ext" or ".ext" or full path)
|
||||
var extension = extname('x.' + path)
|
||||
.toLowerCase()
|
||||
.slice(1)
|
||||
|
||||
if (!extension) {
|
||||
return false
|
||||
}
|
||||
|
||||
return exports.types[extension] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the extensions and types maps.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function populateMaps (extensions, types) {
|
||||
Object.keys(db).forEach(function forEachMimeType (type) {
|
||||
var mime = db[type]
|
||||
var exts = mime.extensions
|
||||
|
||||
if (!exts || !exts.length) {
|
||||
return
|
||||
}
|
||||
|
||||
// mime -> extensions
|
||||
extensions[type] = exts
|
||||
|
||||
// extension -> mime
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
var extension = exts[i]
|
||||
types[extension] = _preferredType(extension, types[extension], type)
|
||||
|
||||
// DELETE (eventually): Capture extension->type maps that change as a
|
||||
// result of switching to mime-score. This is just to help make reviewing
|
||||
// PR #119 easier, and can be removed once that PR is approved.
|
||||
const legacyType = _preferredTypeLegacy(
|
||||
extension,
|
||||
types[extension],
|
||||
type
|
||||
)
|
||||
if (legacyType !== types[extension]) {
|
||||
exports._extensionConflicts.push([extension, legacyType, types[extension]])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Resolve type conflict using mime-score
|
||||
function _preferredType (ext, type0, type1) {
|
||||
var score0 = type0 ? mimeScore(type0, db[type0].source) : 0
|
||||
var score1 = type1 ? mimeScore(type1, db[type1].source) : 0
|
||||
|
||||
return score0 > score1 ? type0 : type1
|
||||
}
|
||||
|
||||
// Resolve type conflict using pre-mime-score logic
|
||||
function _preferredTypeLegacy (ext, type0, type1) {
|
||||
var SOURCE_RANK = ['nginx', 'apache', undefined, 'iana']
|
||||
|
||||
var score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0
|
||||
var score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0
|
||||
|
||||
if (
|
||||
exports.types[extension] !== 'application/octet-stream' &&
|
||||
(score0 > score1 ||
|
||||
(score0 === score1 &&
|
||||
exports.types[extension]?.slice(0, 12) === 'application/'))
|
||||
) {
|
||||
return type0
|
||||
}
|
||||
|
||||
return score0 > score1 ? type0 : type1
|
||||
}
|
||||
57
node_modules/send/node_modules/mime-types/mimeScore.js
generated
vendored
Normal file
57
node_modules/send/node_modules/mime-types/mimeScore.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// 'mime-score' back-ported to CommonJS
|
||||
|
||||
// Score RFC facets (see https://tools.ietf.org/html/rfc6838#section-3)
|
||||
var FACET_SCORES = {
|
||||
'prs.': 100,
|
||||
'x-': 200,
|
||||
'x.': 300,
|
||||
'vnd.': 400,
|
||||
default: 900
|
||||
}
|
||||
|
||||
// Score mime source (Logic originally from `jshttp/mime-types` module)
|
||||
var SOURCE_SCORES = {
|
||||
nginx: 10,
|
||||
apache: 20,
|
||||
iana: 40,
|
||||
default: 30 // definitions added by `jshttp/mime-db` project?
|
||||
}
|
||||
|
||||
var TYPE_SCORES = {
|
||||
// prefer application/xml over text/xml
|
||||
// prefer application/rtf over text/rtf
|
||||
application: 1,
|
||||
|
||||
// prefer font/woff over application/font-woff
|
||||
font: 2,
|
||||
|
||||
// prefer video/mp4 over audio/mp4 over application/mp4
|
||||
// See https://www.rfc-editor.org/rfc/rfc4337.html#section-2
|
||||
audio: 2,
|
||||
video: 3,
|
||||
|
||||
default: 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Get each component of the score for a mime type. The sum of these is the
|
||||
* total score. The higher the score, the more "official" the type.
|
||||
*/
|
||||
module.exports = function mimeScore (mimeType, source = 'default') {
|
||||
if (mimeType === 'application/octet-stream') {
|
||||
return 0
|
||||
}
|
||||
|
||||
const [type, subtype] = mimeType.split('/')
|
||||
|
||||
const facet = subtype.replace(/(\.|x-).*/, '$1')
|
||||
|
||||
const facetScore = FACET_SCORES[facet] || FACET_SCORES.default
|
||||
const sourceScore = SOURCE_SCORES[source] || SOURCE_SCORES.default
|
||||
const typeScore = TYPE_SCORES[type] || TYPE_SCORES.default
|
||||
|
||||
// All else being equal prefer shorter types
|
||||
const lengthScore = 1 - mimeType.length / 100
|
||||
|
||||
return facetScore + sourceScore + typeScore + lengthScore
|
||||
}
|
||||
49
node_modules/send/node_modules/mime-types/package.json
generated
vendored
Normal file
49
node_modules/send/node_modules/mime-types/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "mime-types",
|
||||
"description": "The ultimate javascript content-type utility.",
|
||||
"version": "3.0.2",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"types"
|
||||
],
|
||||
"repository": "jshttp/mime-types",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
},
|
||||
"dependencies": {
|
||||
"mime-db": "^1.54.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "8.33.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.32.0",
|
||||
"eslint-plugin-markdown": "3.0.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "6.6.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "10.8.2",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"mimeScore.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec test/test.js",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
60
node_modules/send/package.json
generated
vendored
Normal file
60
node_modules/send/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "send",
|
||||
"description": "Better streaming static file server with Range and conditional-GET support",
|
||||
"version": "1.2.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": "^4.3.5",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"mime-types": "^3.0.1",
|
||||
"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": "^10.7.0",
|
||||
"nyc": "^17.0.0",
|
||||
"supertest": "6.2.2"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --check-leaks --reporter spec",
|
||||
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"version": "node scripts/version-history.js && git add HISTORY.md"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user