diff options
Diffstat (limited to 'node_modules/clone-response')
-rw-r--r-- | node_modules/clone-response/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/clone-response/README.md | 62 | ||||
-rw-r--r-- | node_modules/clone-response/package.json | 44 | ||||
-rw-r--r-- | node_modules/clone-response/src/index.js | 17 |
4 files changed, 0 insertions, 144 deletions
diff --git a/node_modules/clone-response/LICENSE b/node_modules/clone-response/LICENSE deleted file mode 100644 index f27ee9b..0000000 --- a/node_modules/clone-response/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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. diff --git a/node_modules/clone-response/README.md b/node_modules/clone-response/README.md deleted file mode 100644 index d037cfe..0000000 --- a/node_modules/clone-response/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# clone-response - -> Clone a Node.js HTTP response stream - -[![Build Status](https://travis-ci.org/lukechilds/clone-response.svg?branch=master)](https://travis-ci.org/lukechilds/clone-response) -[![Coverage Status](https://coveralls.io/repos/github/lukechilds/clone-response/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/clone-response?branch=master) -[![npm](https://img.shields.io/npm/dm/clone-response.svg)](https://www.npmjs.com/package/clone-response) -[![npm](https://img.shields.io/npm/v/clone-response.svg)](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 diff --git a/node_modules/clone-response/package.json b/node_modules/clone-response/package.json deleted file mode 100644 index 2cb9aa6..0000000 --- a/node_modules/clone-response/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "clone-response", - "version": "1.0.2", - "description": "Clone a Node.js HTTP response stream", - "main": "src/index.js", - "scripts": { - "test": "xo && nyc ava", - "coverage": "nyc report --reporter=text-lcov | coveralls" - }, - "xo": { - "extends": "xo-lukechilds" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/lukechilds/clone-response.git" - }, - "keywords": [ - "clone", - "duplicate", - "copy", - "response", - "HTTP", - "stream" - ], - "author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)", - "license": "MIT", - "bugs": { - "url": "https://github.com/lukechilds/clone-response/issues" - }, - "homepage": "https://github.com/lukechilds/clone-response", - "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" - } -} diff --git a/node_modules/clone-response/src/index.js b/node_modules/clone-response/src/index.js deleted file mode 100644 index 0285dff..0000000 --- a/node_modules/clone-response/src/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'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; |