Added the node modules.
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 33s
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 33s
This commit is contained in:
19
node_modules/@fastify/busboy/LICENSE
generated
vendored
Normal file
19
node_modules/@fastify/busboy/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
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.
|
271
node_modules/@fastify/busboy/README.md
generated
vendored
Normal file
271
node_modules/@fastify/busboy/README.md
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
# busboy
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/fastify/busboy/actions)
|
||||
[](https://coveralls.io/r/fastify/busboy?branch=master)
|
||||
[](https://standardjs.com/)
|
||||
[](https://github.com/nodejs/security-wg/blob/HEAD/processes/responsible_disclosure_template.md)
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://www.npmjs.com/package/@fastify/busboy)
|
||||
[](https://www.npmjs.com/package/@fastify/busboy)
|
||||
|
||||
</div>
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
A Node.js module for parsing incoming HTML form data.
|
||||
|
||||
This is an officially supported fork by [fastify](https://github.com/fastify/) organization of the amazing library [originally created](https://github.com/mscdex/busboy) by Brian White,
|
||||
aimed at addressing long-standing issues with it.
|
||||
|
||||
Benchmark (Mean time for 500 Kb payload, 2000 cycles, 1000 cycle warmup):
|
||||
|
||||
| Library | Version | Mean time in nanoseconds (less is better) |
|
||||
|-----------------------|---------|-------------------------------------------|
|
||||
| busboy | 0.3.1 | `340114` |
|
||||
| @fastify/busboy | 1.0.0 | `270984` |
|
||||
|
||||
[Changelog](https://github.com/fastify/busboy/blob/master/CHANGELOG.md) since busboy 0.31.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* [Node.js](http://nodejs.org/) 10+
|
||||
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
npm i @fastify/busboy
|
||||
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
* Parsing (multipart) with default options:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const { inspect } = require('node:util');
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer((req, res) => {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
|
||||
console.log(`File [${fieldname}]: filename: ${filename}, encoding: ${encoding}, mimetype: ${mimetype}`);
|
||||
file.on('data', data => {
|
||||
console.log(`File [${fieldname}] got ${data.length} bytes`);
|
||||
});
|
||||
file.on('end', () => {
|
||||
console.log(`File [${fieldname}] Finished`);
|
||||
});
|
||||
});
|
||||
busboy.on('field', (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) => {
|
||||
console.log(`Field [${fieldname}]: value: ${inspect(val)}`);
|
||||
});
|
||||
busboy.on('finish', () => {
|
||||
console.log('Done parsing form!');
|
||||
res.writeHead(303, { Connection: 'close', Location: '/' });
|
||||
res.end();
|
||||
});
|
||||
req.pipe(busboy);
|
||||
} else if (req.method === 'GET') {
|
||||
res.writeHead(200, { Connection: 'close' });
|
||||
res.end(`<html><head></head><body>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="text" name="textfield"><br>
|
||||
<input type="file" name="filefield"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body></html>`);
|
||||
}
|
||||
}).listen(8000, () => {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
|
||||
// Example output, using http://nodejs.org/images/ryan-speaker.jpg as the file:
|
||||
//
|
||||
// Listening for requests
|
||||
// File [filefield]: filename: ryan-speaker.jpg, encoding: binary
|
||||
// File [filefield] got 11971 bytes
|
||||
// Field [textfield]: value: 'testing! :-)'
|
||||
// File [filefield] Finished
|
||||
// Done parsing form!
|
||||
```
|
||||
|
||||
* Save all incoming files to disk:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
|
||||
var saveTo = path.join(os.tmpdir(), path.basename(fieldname));
|
||||
file.pipe(fs.createWriteStream(saveTo));
|
||||
});
|
||||
busboy.on('finish', function() {
|
||||
res.writeHead(200, { 'Connection': 'close' });
|
||||
res.end("That's all folks!");
|
||||
});
|
||||
return req.pipe(busboy);
|
||||
}
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
}).listen(8000, function() {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
```
|
||||
|
||||
* Parsing (urlencoded) with default options:
|
||||
|
||||
```javascript
|
||||
const http = require('node:http');
|
||||
const { inspect } = require('node:util');
|
||||
|
||||
const Busboy = require('busboy');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
|
||||
console.log('File [' + fieldname + ']: filename: ' + filename);
|
||||
file.on('data', function(data) {
|
||||
console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
|
||||
});
|
||||
file.on('end', function() {
|
||||
console.log('File [' + fieldname + '] Finished');
|
||||
});
|
||||
});
|
||||
busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated) {
|
||||
console.log('Field [' + fieldname + ']: value: ' + inspect(val));
|
||||
});
|
||||
busboy.on('finish', function() {
|
||||
console.log('Done parsing form!');
|
||||
res.writeHead(303, { Connection: 'close', Location: '/' });
|
||||
res.end();
|
||||
});
|
||||
req.pipe(busboy);
|
||||
} else if (req.method === 'GET') {
|
||||
res.writeHead(200, { Connection: 'close' });
|
||||
res.end('<html><head></head><body>\
|
||||
<form method="POST">\
|
||||
<input type="text" name="textfield"><br />\
|
||||
<select name="selectfield">\
|
||||
<option value="1">1</option>\
|
||||
<option value="10">10</option>\
|
||||
<option value="100">100</option>\
|
||||
<option value="9001">9001</option>\
|
||||
</select><br />\
|
||||
<input type="checkbox" name="checkfield">Node.js rules!<br />\
|
||||
<input type="submit">\
|
||||
</form>\
|
||||
</body></html>');
|
||||
}
|
||||
}).listen(8000, function() {
|
||||
console.log('Listening for requests');
|
||||
});
|
||||
|
||||
// Example output:
|
||||
//
|
||||
// Listening for requests
|
||||
// Field [textfield]: value: 'testing! :-)'
|
||||
// Field [selectfield]: value: '9001'
|
||||
// Field [checkfield]: value: 'on'
|
||||
// Done parsing form!
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
===
|
||||
|
||||
_Busboy_ is a _Writable_ stream
|
||||
|
||||
Busboy (special) events
|
||||
-----------------------
|
||||
|
||||
* **file**(< _string_ >fieldname, < _ReadableStream_ >stream, < _string_ >filename, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new file form field found. `transferEncoding` contains the 'Content-Transfer-Encoding' value for the file stream. `mimeType` contains the 'Content-Type' value for the file stream.
|
||||
* Note: if you listen for this event, you should always handle the `stream` no matter if you care about the file contents or not (e.g. you can simply just do `stream.resume();` if you want to discard the contents), otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any** incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically and safely discarded (these discarded files do still count towards `files` and `parts` limits).
|
||||
* If a configured file size limit was reached, `stream` will both have a boolean property `truncated` (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.
|
||||
* The property `bytesRead` informs about the number of bytes that have been read so far.
|
||||
|
||||
* **field**(< _string_ >fieldname, < _string_ >value, < _boolean_ >fieldnameTruncated, < _boolean_ >valueTruncated, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new non-file field found.
|
||||
|
||||
* **partsLimit**() - Emitted when specified `parts` limit has been reached. No more 'file' or 'field' events will be emitted.
|
||||
|
||||
* **filesLimit**() - Emitted when specified `files` limit has been reached. No more 'file' events will be emitted.
|
||||
|
||||
* **fieldsLimit**() - Emitted when specified `fields` limit has been reached. No more 'field' events will be emitted.
|
||||
|
||||
|
||||
Busboy methods
|
||||
--------------
|
||||
|
||||
* **(constructor)**(< _object_ >config) - Creates and returns a new Busboy instance.
|
||||
|
||||
* The constructor takes the following valid `config` settings:
|
||||
|
||||
* **headers** - _object_ - These are the HTTP headers of the incoming request, which are used by individual parsers.
|
||||
|
||||
* **autoDestroy** - _boolean_ - Whether this stream should automatically call .destroy() on itself after ending. (Default: false).
|
||||
|
||||
* **highWaterMark** - _integer_ - highWaterMark to use for this Busboy instance (Default: WritableStream default).
|
||||
|
||||
* **fileHwm** - _integer_ - highWaterMark to use for file streams (Default: ReadableStream default).
|
||||
|
||||
* **defCharset** - _string_ - Default character set to use when one isn't defined (Default: 'utf8').
|
||||
|
||||
* **preservePath** - _boolean_ - If paths in the multipart 'filename' field shall be preserved. (Default: false).
|
||||
|
||||
* **isPartAFile** - __function__ - Use this function to override the default file detection functionality. It has following parameters:
|
||||
|
||||
* fieldName - __string__ The name of the field.
|
||||
|
||||
* contentType - __string__ The content-type of the part, e.g. `text/plain`, `image/jpeg`, `application/octet-stream`
|
||||
|
||||
* fileName - __string__ The name of a file supplied by the part.
|
||||
|
||||
(Default: `(fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)`)
|
||||
|
||||
* **limits** - _object_ - Various limits on incoming data. Valid properties are:
|
||||
|
||||
* **fieldNameSize** - _integer_ - Max field name size (in bytes) (Default: 100 bytes).
|
||||
|
||||
* **fieldSize** - _integer_ - Max field value size (in bytes) (Default: 1 MiB, which is 1024 x 1024 bytes).
|
||||
|
||||
* **fields** - _integer_ - Max number of non-file fields (Default: Infinity).
|
||||
|
||||
* **fileSize** - _integer_ - For multipart forms, the max file size (in bytes) (Default: Infinity).
|
||||
|
||||
* **files** - _integer_ - For multipart forms, the max number of file fields (Default: Infinity).
|
||||
|
||||
* **parts** - _integer_ - For multipart forms, the max number of parts (fields + files) (Default: Infinity).
|
||||
|
||||
* **headerPairs** - _integer_ - For multipart forms, the max number of header key=>value pairs to parse **Default:** 2000
|
||||
|
||||
* **headerSize** - _integer_ - For multipart forms, the max size of a multipart header **Default:** 81920.
|
||||
|
||||
* The constructor can throw errors:
|
||||
|
||||
* **Busboy expected an options-Object.** - Busboy expected an Object as first parameters.
|
||||
|
||||
* **Busboy expected an options-Object with headers-attribute.** - The first parameter is lacking of a headers-attribute.
|
||||
|
||||
* **Limit $limit is not a valid number** - Busboy expected the desired limit to be of type number. Busboy throws this Error to prevent a potential security issue by falling silently back to the Busboy-defaults. Potential source for this Error can be the direct use of environment variables without transforming them to the type number.
|
||||
|
||||
* **Unsupported Content-Type.** - The `Content-Type` isn't one Busboy can parse.
|
||||
|
||||
* **Missing Content-Type-header.** - The provided headers don't include `Content-Type` at all.
|
19
node_modules/@fastify/busboy/deps/dicer/LICENSE
generated
vendored
Normal file
19
node_modules/@fastify/busboy/deps/dicer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
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.
|
228
node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
generated
vendored
Normal file
228
node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Copyright Brian White. All rights reserved.
|
||||
*
|
||||
* @see https://github.com/mscdex/streamsearch
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation
|
||||
* by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool
|
||||
*/
|
||||
const EventEmitter = require('node:events').EventEmitter
|
||||
const inherits = require('node:util').inherits
|
||||
|
||||
function SBMH (needle) {
|
||||
if (typeof needle === 'string') {
|
||||
needle = Buffer.from(needle)
|
||||
}
|
||||
|
||||
if (!Buffer.isBuffer(needle)) {
|
||||
throw new TypeError('The needle has to be a String or a Buffer.')
|
||||
}
|
||||
|
||||
const needleLength = needle.length
|
||||
|
||||
if (needleLength === 0) {
|
||||
throw new Error('The needle cannot be an empty String/Buffer.')
|
||||
}
|
||||
|
||||
if (needleLength > 256) {
|
||||
throw new Error('The needle cannot have a length bigger than 256.')
|
||||
}
|
||||
|
||||
this.maxMatches = Infinity
|
||||
this.matches = 0
|
||||
|
||||
this._occ = new Array(256)
|
||||
.fill(needleLength) // Initialize occurrence table.
|
||||
this._lookbehind_size = 0
|
||||
this._needle = needle
|
||||
this._bufpos = 0
|
||||
|
||||
this._lookbehind = Buffer.alloc(needleLength)
|
||||
|
||||
// Populate occurrence table with analysis of the needle,
|
||||
// ignoring last letter.
|
||||
for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var
|
||||
this._occ[needle[i]] = needleLength - 1 - i
|
||||
}
|
||||
}
|
||||
inherits(SBMH, EventEmitter)
|
||||
|
||||
SBMH.prototype.reset = function () {
|
||||
this._lookbehind_size = 0
|
||||
this.matches = 0
|
||||
this._bufpos = 0
|
||||
}
|
||||
|
||||
SBMH.prototype.push = function (chunk, pos) {
|
||||
if (!Buffer.isBuffer(chunk)) {
|
||||
chunk = Buffer.from(chunk, 'binary')
|
||||
}
|
||||
const chlen = chunk.length
|
||||
this._bufpos = pos || 0
|
||||
let r
|
||||
while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) }
|
||||
return r
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_feed = function (data) {
|
||||
const len = data.length
|
||||
const needle = this._needle
|
||||
const needleLength = needle.length
|
||||
const lastNeedleChar = needle[needleLength - 1]
|
||||
|
||||
// Positive: points to a position in `data`
|
||||
// pos == 3 points to data[3]
|
||||
// Negative: points to a position in the lookbehind buffer
|
||||
// pos == -2 points to lookbehind[lookbehind_size - 2]
|
||||
let pos = -this._lookbehind_size
|
||||
let ch
|
||||
|
||||
if (pos < 0) {
|
||||
// Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool
|
||||
// search with character lookup code that considers both the
|
||||
// lookbehind buffer and the current round's haystack data.
|
||||
//
|
||||
// Loop until
|
||||
// there is a match.
|
||||
// or until
|
||||
// we've moved past the position that requires the
|
||||
// lookbehind buffer. In this case we switch to the
|
||||
// optimized loop.
|
||||
// or until
|
||||
// the character to look at lies outside the haystack.
|
||||
while (pos < 0 && pos <= len - needleLength) {
|
||||
ch = this._sbmh_lookup_char(data, pos + needleLength - 1)
|
||||
|
||||
if (
|
||||
ch === lastNeedleChar &&
|
||||
this._sbmh_memcmp(data, pos, needleLength - 1)
|
||||
) {
|
||||
this._lookbehind_size = 0
|
||||
++this.matches
|
||||
this.emit('info', true)
|
||||
|
||||
return (this._bufpos = pos + needleLength)
|
||||
}
|
||||
pos += this._occ[ch]
|
||||
}
|
||||
|
||||
// No match.
|
||||
|
||||
if (pos < 0) {
|
||||
// There's too few data for Boyer-Moore-Horspool to run,
|
||||
// so let's use a different algorithm to skip as much as
|
||||
// we can.
|
||||
// Forward pos until
|
||||
// the trailing part of lookbehind + data
|
||||
// looks like the beginning of the needle
|
||||
// or until
|
||||
// pos == 0
|
||||
while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos }
|
||||
}
|
||||
|
||||
if (pos >= 0) {
|
||||
// Discard lookbehind buffer.
|
||||
this.emit('info', false, this._lookbehind, 0, this._lookbehind_size)
|
||||
this._lookbehind_size = 0
|
||||
} else {
|
||||
// Cut off part of the lookbehind buffer that has
|
||||
// been processed and append the entire haystack
|
||||
// into it.
|
||||
const bytesToCutOff = this._lookbehind_size + pos
|
||||
if (bytesToCutOff > 0) {
|
||||
// The cut off data is guaranteed not to contain the needle.
|
||||
this.emit('info', false, this._lookbehind, 0, bytesToCutOff)
|
||||
}
|
||||
|
||||
this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff,
|
||||
this._lookbehind_size - bytesToCutOff)
|
||||
this._lookbehind_size -= bytesToCutOff
|
||||
|
||||
data.copy(this._lookbehind, this._lookbehind_size)
|
||||
this._lookbehind_size += len
|
||||
|
||||
this._bufpos = len
|
||||
return len
|
||||
}
|
||||
}
|
||||
|
||||
pos += (pos >= 0) * this._bufpos
|
||||
|
||||
// Lookbehind buffer is now empty. We only need to check if the
|
||||
// needle is in the haystack.
|
||||
if (data.indexOf(needle, pos) !== -1) {
|
||||
pos = data.indexOf(needle, pos)
|
||||
++this.matches
|
||||
if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) }
|
||||
|
||||
return (this._bufpos = pos + needleLength)
|
||||
} else {
|
||||
pos = len - needleLength
|
||||
}
|
||||
|
||||
// There was no match. If there's trailing haystack data that we cannot
|
||||
// match yet using the Boyer-Moore-Horspool algorithm (because the trailing
|
||||
// data is less than the needle size) then match using a modified
|
||||
// algorithm that starts matching from the beginning instead of the end.
|
||||
// Whatever trailing data is left after running this algorithm is added to
|
||||
// the lookbehind buffer.
|
||||
while (
|
||||
pos < len &&
|
||||
(
|
||||
data[pos] !== needle[0] ||
|
||||
(
|
||||
(Buffer.compare(
|
||||
data.subarray(pos, pos + len - pos),
|
||||
needle.subarray(0, len - pos)
|
||||
) !== 0)
|
||||
)
|
||||
)
|
||||
) {
|
||||
++pos
|
||||
}
|
||||
if (pos < len) {
|
||||
data.copy(this._lookbehind, 0, pos, pos + (len - pos))
|
||||
this._lookbehind_size = len - pos
|
||||
}
|
||||
|
||||
// Everything until pos is guaranteed not to contain needle data.
|
||||
if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) }
|
||||
|
||||
this._bufpos = len
|
||||
return len
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_lookup_char = function (data, pos) {
|
||||
return (pos < 0)
|
||||
? this._lookbehind[this._lookbehind_size + pos]
|
||||
: data[pos]
|
||||
}
|
||||
|
||||
SBMH.prototype._sbmh_memcmp = function (data, pos, len) {
|
||||
for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
|
||||
if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = SBMH
|
86
node_modules/@fastify/busboy/package.json
generated
vendored
Normal file
86
node_modules/@fastify/busboy/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "@fastify/busboy",
|
||||
"version": "2.1.0",
|
||||
"private": false,
|
||||
"author": "Brian White <mscdex@mscdex.net>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Igor Savin",
|
||||
"email": "kibertoad@gmail.com",
|
||||
"url": "https://github.com/kibertoad"
|
||||
},
|
||||
{
|
||||
"name": "Aras Abbasi",
|
||||
"email": "aras.abbasi@gmail.com",
|
||||
"url": "https://github.com/uzlopak"
|
||||
}
|
||||
],
|
||||
"description": "A streaming parser for HTML form data for node.js",
|
||||
"main": "lib/main",
|
||||
"type": "commonjs",
|
||||
"types": "lib/main.d.ts",
|
||||
"scripts": {
|
||||
"bench:busboy": "cd benchmarks && npm install && npm run benchmark-fastify",
|
||||
"bench:dicer": "node bench/dicer/dicer-bench-multipart-parser.js",
|
||||
"coveralls": "nyc report --reporter=lcov",
|
||||
"lint": "npm run lint:standard",
|
||||
"lint:everything": "npm run lint && npm run test:types",
|
||||
"lint:fix": "standard --fix",
|
||||
"lint:standard": "standard --verbose | snazzy",
|
||||
"test:mocha": "tap",
|
||||
"test:types": "tsd",
|
||||
"test:coverage": "nyc npm run test",
|
||||
"test": "npm run test:mocha"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.1.0",
|
||||
"busboy": "^1.0.0",
|
||||
"photofinish": "^1.8.0",
|
||||
"snazzy": "^9.0.0",
|
||||
"standard": "^17.0.0",
|
||||
"tap": "^16.3.8",
|
||||
"tinybench": "^2.5.1",
|
||||
"tsd": "^0.29.0",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"keywords": [
|
||||
"uploads",
|
||||
"forms",
|
||||
"multipart",
|
||||
"form-data"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fastify/busboy.git"
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "test/types",
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": false,
|
||||
"module": "commonjs",
|
||||
"target": "ES2017"
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"it"
|
||||
],
|
||||
"ignore": [
|
||||
"bench"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"lib/*",
|
||||
"deps/encoding/*",
|
||||
"deps/dicer/lib",
|
||||
"deps/streamsearch/",
|
||||
"deps/dicer/LICENSE"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user