sistema creado v0.5.0
This commit is contained in:
54
api/node_modules/send/HISTORY.md
generated
vendored
54
api/node_modules/send/HISTORY.md
generated
vendored
@@ -1,57 +1,3 @@
|
||||
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
|
||||
===================
|
||||
|
||||
|
||||
36
api/node_modules/send/README.md
generated
vendored
36
api/node_modules/send/README.md
generated
vendored
@@ -2,7 +2,8 @@
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![CI][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Send is a library for streaming files from the file system as a http response
|
||||
@@ -54,7 +55,7 @@ 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
|
||||
checked (i.e. the root itself can be within a dotfile when when set
|
||||
to "deny").
|
||||
|
||||
- `'allow'` No special treatment for dotfiles.
|
||||
@@ -132,6 +133,15 @@ The `SendStream` is an event emitter and will emit the following events:
|
||||
The `pipe` method is used to pipe the response into the Node.js HTTP response
|
||||
object, typically `send(req, path, options).pipe(res)`.
|
||||
|
||||
### .mime
|
||||
|
||||
The `mime` export is the global instance of of the
|
||||
[`mime` npm module](https://www.npmjs.com/package/mime).
|
||||
|
||||
This is used to configure the MIME types that are associated with file extensions
|
||||
as well as other options for how to resolve the MIME type of a file (like the
|
||||
default type to use for an unknown file extension).
|
||||
|
||||
## Error-handling
|
||||
|
||||
By default when no `error` listeners are present an automatic response will be
|
||||
@@ -200,22 +210,20 @@ server.listen(3000)
|
||||
### Custom file types
|
||||
|
||||
```js
|
||||
var extname = require('path').extname
|
||||
var http = require('http')
|
||||
var parseUrl = require('parseurl')
|
||||
var send = require('send')
|
||||
|
||||
// Default unknown types to text/plain
|
||||
send.mime.default_type = 'text/plain'
|
||||
|
||||
// Add a custom type
|
||||
send.mime.define({
|
||||
'application/x-my-type': ['x-mt', 'x-mtt']
|
||||
})
|
||||
|
||||
var server = http.createServer(function onRequest (req, res) {
|
||||
send(req, parseUrl(req).pathname, { root: '/www/public' })
|
||||
.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)
|
||||
})
|
||||
|
||||
@@ -224,7 +232,7 @@ server.listen(3000)
|
||||
|
||||
### Custom directory index view
|
||||
|
||||
This is an example of serving up a structure of directories with a
|
||||
This is a example of serving up a structure of directories with a
|
||||
custom function to render a listing of a directory.
|
||||
|
||||
```js
|
||||
@@ -306,6 +314,8 @@ server.listen(3000)
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux
|
||||
|
||||
173
api/node_modules/send/index.js
generated
vendored
173
api/node_modules/send/index.js
generated
vendored
@@ -14,12 +14,14 @@
|
||||
|
||||
var createError = require('http-errors')
|
||||
var debug = require('debug')('send')
|
||||
var deprecate = require('depd')('send')
|
||||
var destroy = require('destroy')
|
||||
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 mime = require('mime')
|
||||
var ms = require('ms')
|
||||
var onFinished = require('on-finished')
|
||||
var parseRange = require('range-parser')
|
||||
@@ -66,6 +68,7 @@ var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/
|
||||
*/
|
||||
|
||||
module.exports = send
|
||||
module.exports.mime = mime
|
||||
|
||||
/**
|
||||
* Return a `SendStream` for `req` and `path`.
|
||||
@@ -119,6 +122,17 @@ function SendStream (req, path, options) {
|
||||
throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
|
||||
}
|
||||
|
||||
this._hidden = Boolean(opts.hidden)
|
||||
|
||||
if (opts.hidden !== undefined) {
|
||||
deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead')
|
||||
}
|
||||
|
||||
// legacy support
|
||||
if (opts.dotfiles === undefined) {
|
||||
this._dotfiles = undefined
|
||||
}
|
||||
|
||||
this._extensions = opts.extensions !== undefined
|
||||
? normalizeList(opts.extensions, 'extensions option')
|
||||
: []
|
||||
@@ -146,6 +160,10 @@ function SendStream (req, path, options) {
|
||||
this._root = opts.root
|
||||
? resolve(opts.root)
|
||||
: null
|
||||
|
||||
if (!this._root && opts.from) {
|
||||
this.from(opts.from)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,6 +172,90 @@ function SendStream (req, path, options) {
|
||||
|
||||
util.inherits(SendStream, Stream)
|
||||
|
||||
/**
|
||||
* Enable or disable etag generation.
|
||||
*
|
||||
* @param {Boolean} val
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.etag = deprecate.function(function etag (val) {
|
||||
this._etag = Boolean(val)
|
||||
debug('etag %s', this._etag)
|
||||
return this
|
||||
}, 'send.etag: pass etag as option')
|
||||
|
||||
/**
|
||||
* Enable or disable "hidden" (dot) files.
|
||||
*
|
||||
* @param {Boolean} path
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.hidden = deprecate.function(function hidden (val) {
|
||||
this._hidden = Boolean(val)
|
||||
this._dotfiles = undefined
|
||||
debug('hidden %s', this._hidden)
|
||||
return this
|
||||
}, 'send.hidden: use dotfiles option')
|
||||
|
||||
/**
|
||||
* Set index `paths`, set to a falsy
|
||||
* value to disable index support.
|
||||
*
|
||||
* @param {String|Boolean|Array} paths
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.index = deprecate.function(function index (paths) {
|
||||
var index = !paths ? [] : normalizeList(paths, 'paths argument')
|
||||
debug('index %o', paths)
|
||||
this._index = index
|
||||
return this
|
||||
}, 'send.index: pass index as option')
|
||||
|
||||
/**
|
||||
* Set root `path`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.root = function root (path) {
|
||||
this._root = resolve(String(path))
|
||||
debug('root %s', this._root)
|
||||
return this
|
||||
}
|
||||
|
||||
SendStream.prototype.from = deprecate.function(SendStream.prototype.root,
|
||||
'send.from: pass root as option')
|
||||
|
||||
SendStream.prototype.root = deprecate.function(SendStream.prototype.root,
|
||||
'send.root: pass root as option')
|
||||
|
||||
/**
|
||||
* Set max-age to `maxAge`.
|
||||
*
|
||||
* @param {Number} maxAge
|
||||
* @return {SendStream}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SendStream.prototype.maxage = deprecate.function(function maxage (maxAge) {
|
||||
this._maxage = typeof maxAge === 'string'
|
||||
? ms(maxAge)
|
||||
: Number(maxAge)
|
||||
this._maxage = !isNaN(this._maxage)
|
||||
? Math.min(Math.max(0, this._maxage), MAX_MAXAGE)
|
||||
: 0
|
||||
debug('max-age %d', this._maxage)
|
||||
return this
|
||||
}, 'send.maxage: pass maxAge as option')
|
||||
|
||||
/**
|
||||
* Emit error with `status`.
|
||||
*
|
||||
@@ -456,8 +558,17 @@ SendStream.prototype.pipe = function pipe (res) {
|
||||
|
||||
// dotfile handling
|
||||
if (containsDotFile(parts)) {
|
||||
debug('%s dotfile "%s"', this._dotfiles, path)
|
||||
switch (this._dotfiles) {
|
||||
var access = this._dotfiles
|
||||
|
||||
// legacy support
|
||||
if (access === undefined) {
|
||||
access = parts[parts.length - 1][0] === '.'
|
||||
? (this._hidden ? 'allow' : 'ignore')
|
||||
: 'allow'
|
||||
}
|
||||
|
||||
debug('%s dotfile "%s"', access, path)
|
||||
switch (access) {
|
||||
case 'allow':
|
||||
break
|
||||
case 'deny':
|
||||
@@ -496,7 +607,7 @@ SendStream.prototype.send = function send (path, stat) {
|
||||
var ranges = req.headers.range
|
||||
var offset = options.start || 0
|
||||
|
||||
if (res.headersSent) {
|
||||
if (headersSent(res)) {
|
||||
// impossible to send now
|
||||
this.headersAlreadySent()
|
||||
return
|
||||
@@ -603,14 +714,12 @@ SendStream.prototype.sendFile = function sendFile (path) {
|
||||
|
||||
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) {
|
||||
if (err && err.code === 'ENOENT' && !extname(path) && path[path.length - 1] !== sep) {
|
||||
// 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)
|
||||
})
|
||||
@@ -683,7 +792,7 @@ SendStream.prototype.stream = function stream (path, options) {
|
||||
|
||||
// cleanup
|
||||
function cleanup () {
|
||||
stream.destroy()
|
||||
destroy(stream, true)
|
||||
}
|
||||
|
||||
// response finished, cleanup
|
||||
@@ -717,11 +826,17 @@ SendStream.prototype.type = function type (path) {
|
||||
|
||||
if (res.getHeader('Content-Type')) return
|
||||
|
||||
var ext = extname(path)
|
||||
var type = mime.contentType(ext) || 'application/octet-stream'
|
||||
var type = mime.lookup(path)
|
||||
|
||||
if (!type) {
|
||||
debug('no content-type')
|
||||
return
|
||||
}
|
||||
|
||||
var charset = mime.charsets.lookup(type)
|
||||
|
||||
debug('content-type %s', type)
|
||||
res.setHeader('Content-Type', type)
|
||||
res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,8 +890,10 @@ SendStream.prototype.setHeader = function setHeader (path, stat) {
|
||||
*/
|
||||
|
||||
function clearHeaders (res) {
|
||||
for (const header of res.getHeaderNames()) {
|
||||
res.removeHeader(header)
|
||||
var headers = getHeaderNames(res)
|
||||
|
||||
for (var i = 0; i < headers.length; i++) {
|
||||
res.removeHeader(headers[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,10 +1001,24 @@ function decode (path) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header names on a respnse.
|
||||
*
|
||||
* @param {object} res
|
||||
* @returns {array[string]}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getHeaderNames (res) {
|
||||
return typeof res.getHeaderNames !== 'function'
|
||||
? Object.keys(res._headers || {})
|
||||
: res.getHeaderNames()
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* The way to do this check is done three different ways in Node.js >= 0.8
|
||||
* so this consolidates them into a minimal set using instance methods.
|
||||
*
|
||||
* @param {EventEmitter} emitter
|
||||
@@ -904,6 +1035,20 @@ function hasListeners (emitter, type) {
|
||||
return count > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the response headers have been sent.
|
||||
*
|
||||
* @param {object} res
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function headersSent (res) {
|
||||
return typeof res.headersSent !== 'boolean'
|
||||
? Boolean(res._header)
|
||||
: res.headersSent
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize the index option into an array.
|
||||
*
|
||||
|
||||
42
api/node_modules/send/package.json
generated
vendored
42
api/node_modules/send/package.json
generated
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "send",
|
||||
"description": "Better streaming static file server with Range and conditional-GET support",
|
||||
"version": "1.2.0",
|
||||
"version": "0.19.0",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
@@ -16,20 +16,22 @@
|
||||
"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"
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "2.0.0",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"after": "^0.8.2",
|
||||
"after": "0.8.2",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
@@ -37,24 +39,24 @@
|
||||
"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",
|
||||
"mocha": "9.2.2",
|
||||
"nyc": "15.1.0",
|
||||
"supertest": "6.2.2"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"SECURITY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"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"
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user