From b22f6770c8bd084d66950655203c61dd701b3d90 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 4 Jun 2022 08:51:19 +0200 Subject: Remove node_modules --- node_modules/raw-body/.npmignore | 3 - node_modules/raw-body/HISTORY.md | 85 --------------------- node_modules/raw-body/README.md | 100 ------------------------ node_modules/raw-body/index.js | 151 ------------------------------------- node_modules/raw-body/package.json | 27 ------- 5 files changed, 366 deletions(-) delete mode 100644 node_modules/raw-body/.npmignore delete mode 100644 node_modules/raw-body/HISTORY.md delete mode 100644 node_modules/raw-body/README.md delete mode 100644 node_modules/raw-body/index.js delete mode 100644 node_modules/raw-body/package.json (limited to 'node_modules/raw-body') diff --git a/node_modules/raw-body/.npmignore b/node_modules/raw-body/.npmignore deleted file mode 100644 index cd39b77..0000000 --- a/node_modules/raw-body/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -coverage/ -test/ -.travis.yml diff --git a/node_modules/raw-body/HISTORY.md b/node_modules/raw-body/HISTORY.md deleted file mode 100644 index 0731180..0000000 --- a/node_modules/raw-body/HISTORY.md +++ /dev/null @@ -1,85 +0,0 @@ -1.1.7 / 2014-06-12 -================== - - * use `string_decoder` module from npm - -1.1.6 / 2014-05-27 -================== - - * check encoding for old streams1 - * support node.js < 0.10.6 - -1.1.5 / 2014-05-14 -================== - - * bump bytes - -1.1.4 / 2014-04-19 -================== - - * allow true as an option - * bump bytes - -1.1.3 / 2014-03-02 -================== - - * fix case when length=null - -1.1.2 / 2013-12-01 -================== - - * be less strict on state.encoding check - -1.1.1 / 2013-11-27 -================== - - * add engines - -1.1.0 / 2013-11-27 -================== - - * add err.statusCode and err.type - * allow for encoding option to be true - * pause the stream instead of dumping on error - * throw if the stream's encoding is set - -1.0.1 / 2013-11-19 -================== - - * dont support streams1, throw if dev set encoding - -1.0.0 / 2013-11-17 -================== - - * rename `expected` option to `length` - -0.2.0 / 2013-11-15 -================== - - * republish - -0.1.1 / 2013-11-15 -================== - - * use bytes - -0.1.0 / 2013-11-11 -================== - - * generator support - -0.0.3 / 2013-10-10 -================== - - * update repo - -0.0.2 / 2013-09-14 -================== - - * dump stream on bad headers - * listen to events after defining received and buffers - -0.0.1 / 2013-09-14 -================== - - * Initial release diff --git a/node_modules/raw-body/README.md b/node_modules/raw-body/README.md deleted file mode 100644 index 844459d..0000000 --- a/node_modules/raw-body/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# raw-body - -[![NPM version](https://badge.fury.io/js/method-override.svg)](http://badge.fury.io/js/raw-body) -[![Build Status](https://travis-ci.org/stream-utils/raw-body.svg?branch=master)](https://travis-ci.org/stream-utils/raw-body) -[![Coverage Status](https://img.shields.io/coveralls/stream-utils/raw-body.svg?branch=master)](https://coveralls.io/r/stream-utils/raw-body) - -Gets the entire buffer of a stream either as a `Buffer` or a string. -Validates the stream's length against an expected length and maximum limit. -Ideal for parsing request bodies. - -## API - -```js -var getRawBody = require('raw-body') - -app.use(function (req, res, next) { - getRawBody(req, { - length: req.headers['content-length'], - limit: '1mb', - encoding: 'utf8' - }, function (err, string) { - if (err) - return next(err) - - req.text = string - next() - }) -}) -``` - -or in a Koa generator: - -```js -app.use(function* (next) { - var string = yield getRawBody(this.req, { - length: this.length, - limit: '1mb', - encoding: 'utf8' - }) -}) -``` - -### getRawBody(stream, [options], [callback]) - -Returns a thunk for yielding with generators. - -Options: - -- `length` - The length length of the stream. - If the contents of the stream do not add up to this length, - an `400` error code is returned. -- `limit` - The byte limit of the body. - If the body ends up being larger than this limit, - a `413` error code is returned. -- `encoding` - The requested encoding. - By default, a `Buffer` instance will be returned. - Most likely, you want `utf8`. - You can use any type of encoding supported by [StringDecoder](http://nodejs.org/api/string_decoder.html). - You can also pass `true` which sets it to the default `utf8` - -`callback(err, res)`: - -- `err` - the following attributes will be defined if applicable: - - - `limit` - the limit in bytes - - `length` and `expected` - the expected length of the stream - - `received` - the received bytes - - `status` and `statusCode` - the corresponding status code for the error - - `type` - either `entity.too.large`, `request.size.invalid`, or `stream.encoding.set` - -- `res` - the result, either as a `String` if an encoding was set or a `Buffer` otherwise. - -If an error occurs, the stream will be paused, -and you are responsible for correctly disposing the stream. -For HTTP requests, no handling is required if you send a response. -For streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks. - -## License - -The MIT License (MIT) - -Copyright (c) 2013 Jonathan Ong me@jongleberry.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. diff --git a/node_modules/raw-body/index.js b/node_modules/raw-body/index.js deleted file mode 100644 index e3c00aa..0000000 --- a/node_modules/raw-body/index.js +++ /dev/null @@ -1,151 +0,0 @@ -var bytes = require('bytes') - -// NOTE: the trailing slash is not a typo -var StringDecoder = require('string_decoder/').StringDecoder - -module.exports = function (stream, options, done) { - if (typeof options === 'function') { - done = options - options = {} - } else if (!options) { - options = {} - } else if (options === true) { - options = { - encoding: 'utf8' - } - } - - // convert the limit to an integer - var limit = null - if (typeof options.limit === 'number') - limit = options.limit - if (typeof options.limit === 'string') - limit = bytes(options.limit) - - // convert the expected length to an integer - var length = null - if (options.length != null && !isNaN(options.length)) - length = parseInt(options.length, 10) - - // check the length and limit options. - // note: we intentionally leave the stream paused, - // so users should handle the stream themselves. - if (limit !== null && length !== null && length > limit) { - if (typeof stream.pause === 'function') - stream.pause() - - process.nextTick(function () { - var err = makeError('request entity too large', 'entity.too.large') - err.status = err.statusCode = 413 - err.length = err.expected = length - err.limit = limit - done(err) - }) - return defer - } - - // streams1: assert request encoding is buffer. - // streams2+: assert the stream encoding is buffer. - // stream._decoder: streams1 - // state.encoding: streams2 - // state.decoder: streams2, specifically < 0.10.6 - var state = stream._readableState - if (stream._decoder || (state && (state.encoding || state.decoder))) { - if (typeof stream.pause === 'function') - stream.pause() - - process.nextTick(function () { - var err = makeError('stream encoding should not be set', - 'stream.encoding.set') - // developer error - err.status = err.statusCode = 500 - done(err) - }) - return defer - } - - var received = 0 - // note: we delegate any invalid encodings to the constructor - var decoder = options.encoding - ? new StringDecoder(options.encoding === true ? 'utf8' : options.encoding) - : null - var buffer = decoder - ? '' - : [] - - stream.on('data', onData) - stream.once('end', onEnd) - stream.once('error', onEnd) - stream.once('close', cleanup) - - return defer - - // yieldable support - function defer(fn) { - done = fn - } - - function onData(chunk) { - received += chunk.length - decoder - ? buffer += decoder.write(chunk) - : buffer.push(chunk) - - if (limit !== null && received > limit) { - if (typeof stream.pause === 'function') - stream.pause() - var err = makeError('request entity too large', 'entity.too.large') - err.status = err.statusCode = 413 - err.received = received - err.limit = limit - done(err) - cleanup() - } - } - - function onEnd(err) { - if (err) { - if (typeof stream.pause === 'function') - stream.pause() - done(err) - } else if (length !== null && received !== length) { - err = makeError('request size did not match content length', - 'request.size.invalid') - err.status = err.statusCode = 400 - err.received = received - err.length = err.expected = length - done(err) - } else { - done(null, decoder - ? buffer + decoder.end() - : Buffer.concat(buffer) - ) - } - - cleanup() - } - - function cleanup() { - received = buffer = null - - stream.removeListener('data', onData) - stream.removeListener('end', onEnd) - stream.removeListener('error', onEnd) - stream.removeListener('close', cleanup) - } -} - -// to create serializable errors you must re-set message so -// that it is enumerable and you must re configure the type -// property so that is writable and enumerable -function makeError(message, type) { - var error = new Error() - error.message = message - Object.defineProperty(error, 'type', { - value: type, - enumerable: true, - writable: true, - configurable: true - }) - return error -} diff --git a/node_modules/raw-body/package.json b/node_modules/raw-body/package.json deleted file mode 100644 index 90bca64..0000000 --- a/node_modules/raw-body/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "raw-body", - "description": "Get and validate the raw body of a readable stream.", - "version": "1.1.7", - "author": "Jonathan Ong (http://jongleberry.com)", - "license": "MIT", - "repository": "stream-utils/raw-body", - "dependencies": { - "bytes": "1", - "string_decoder": "0.10" - }, - "devDependencies": { - "istanbul": "0.2.10", - "mocha": "~1.20.1", - "readable-stream": "~1.0.17", - "request": ">= 2.36.0 < 3", - "through2": "~0.4.1" - }, - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --reporter spec --bail test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" - } -} -- cgit