Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz"
|
||||
,"_integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws="
|
||||
,"_from": "clone-response@^1.0.2"
|
||||
}
|
||||
+17
@@ -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;
|
||||
Reference in new issue
Block a user