啊啊
This commit is contained in:
21
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/LICENSE
generated
vendored
Normal file
21
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Luke Childs
|
||||
|
||||
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.
|
||||
62
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/README.md
generated
vendored
Normal file
62
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/README.md
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# clone-response
|
||||
|
||||
> Clone a Node.js HTTP response stream
|
||||
|
||||
[](https://travis-ci.org/lukechilds/clone-response)
|
||||
[](https://coveralls.io/github/lukechilds/clone-response?branch=master)
|
||||
[](https://www.npmjs.com/package/clone-response)
|
||||
[](https://www.npmjs.com/package/clone-response)
|
||||
|
||||
Returns a new stream and copies over all properties and methods from the original response giving you a complete duplicate.
|
||||
|
||||
This is useful in situations where you need to consume the response stream but also want to pass an unconsumed stream somewhere else to be consumed later.
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
npm install --save clone-response
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const http = require('http');
|
||||
const cloneResponse = require('clone-response');
|
||||
|
||||
http.get('http://example.com', response => {
|
||||
const clonedResponse = cloneResponse(response);
|
||||
response.pipe(process.stdout);
|
||||
|
||||
setImmediate(() => {
|
||||
// The response stream has already been consumed by the time this executes,
|
||||
// however the cloned response stream is still available.
|
||||
doSomethingWithResponse(clonedResponse);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Please bear in mind that the process of cloning a stream consumes it. However, you can consume a stream multiple times in the same tick, therefore allowing you to create multiple clones. e.g:
|
||||
|
||||
```js
|
||||
const clone1 = cloneResponse(response);
|
||||
const clone2 = cloneResponse(response);
|
||||
// response can still be consumed in this tick but cannot be consumed if passed
|
||||
// into any async callbacks. clone1 and clone2 can be passed around and be
|
||||
// consumed in the future.
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cloneResponse(response)
|
||||
|
||||
Returns a clone of the passed in response.
|
||||
|
||||
#### response
|
||||
|
||||
Type: `stream`
|
||||
|
||||
A [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) to clone.
|
||||
|
||||
## License
|
||||
|
||||
MIT © Luke Childs
|
||||
44
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/package.json
generated
vendored
Normal file
44
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "clone-response",
|
||||
"version": "1.0.3",
|
||||
"description": "Clone a Node.js HTTP response stream",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava",
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"xo": {
|
||||
"extends": "xo-lukechilds"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/clone-response.git"
|
||||
},
|
||||
"keywords": [
|
||||
"clone",
|
||||
"duplicate",
|
||||
"copy",
|
||||
"response",
|
||||
"HTTP",
|
||||
"stream"
|
||||
],
|
||||
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mimic-response": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.22.0",
|
||||
"coveralls": "^2.13.1",
|
||||
"create-test-server": "^2.0.1",
|
||||
"eslint-config-xo-lukechilds": "^1.0.0",
|
||||
"get-stream": "^3.0.0",
|
||||
"nyc": "^11.0.2",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "^0.19.0"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "clone-response@1.0.3",
|
||||
"_resolved": "https://registry.npmmirror.com/clone-response/-/clone-response-1.0.3.tgz"
|
||||
}
|
||||
17
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/src/index.js
generated
vendored
Normal file
17
node_modules/.store/clone-response@1.0.3/node_modules/clone-response/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
const PassThrough = require('stream').PassThrough;
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const cloneResponse = response => {
|
||||
if (!(response && response.pipe)) {
|
||||
throw new TypeError('Parameter `response` must be a response stream.');
|
||||
}
|
||||
|
||||
const clone = new PassThrough();
|
||||
mimicResponse(response, clone);
|
||||
|
||||
return response.pipe(clone);
|
||||
};
|
||||
|
||||
module.exports = cloneResponse;
|
||||
32
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/index.js
generated
vendored
Normal file
32
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
// We define these manually to ensure they're always copied
|
||||
// even if they would move up the prototype chain
|
||||
// https://nodejs.org/api/http.html#http_class_http_incomingmessage
|
||||
const knownProps = [
|
||||
'destroy',
|
||||
'setTimeout',
|
||||
'socket',
|
||||
'headers',
|
||||
'trailers',
|
||||
'rawHeaders',
|
||||
'statusCode',
|
||||
'httpVersion',
|
||||
'httpVersionMinor',
|
||||
'httpVersionMajor',
|
||||
'rawTrailers',
|
||||
'statusMessage'
|
||||
];
|
||||
|
||||
module.exports = (fromStream, toStream) => {
|
||||
const fromProps = new Set(Object.keys(fromStream).concat(knownProps));
|
||||
|
||||
for (const prop of fromProps) {
|
||||
// Don't overwrite existing properties
|
||||
if (prop in toStream) {
|
||||
continue;
|
||||
}
|
||||
|
||||
toStream[prop] = typeof fromStream[prop] === 'function' ? fromStream[prop].bind(fromStream) : fromStream[prop];
|
||||
}
|
||||
};
|
||||
9
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/license
generated
vendored
Normal file
9
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
40
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/package.json
generated
vendored
Normal file
40
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "mimic-response",
|
||||
"version": "1.0.1",
|
||||
"description": "Mimic a Node.js HTTP response stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/mimic-response",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"mimic",
|
||||
"response",
|
||||
"stream",
|
||||
"http",
|
||||
"https",
|
||||
"request",
|
||||
"get",
|
||||
"core"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"create-test-server": "^0.1.0",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "mimic-response@1.0.1",
|
||||
"_resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-1.0.1.tgz"
|
||||
}
|
||||
54
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/readme.md
generated
vendored
Normal file
54
node_modules/.store/clone-response@1.0.3/node_modules/mimic-response/readme.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# mimic-response [](https://travis-ci.org/sindresorhus/mimic-response)
|
||||
|
||||
> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install mimic-response
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stream = require('stream');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const responseStream = getHttpResponseStream();
|
||||
const myStream = new stream.PassThrough();
|
||||
|
||||
mimicResponse(responseStream, myStream);
|
||||
|
||||
console.log(myStream.statusCode);
|
||||
//=> 200
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### mimicResponse(from, to)
|
||||
|
||||
#### from
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
[Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
#### to
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
Any stream.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one
|
||||
- [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user