Clone a Node.js HTTP response stream
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.
npm install --save clone-response
const http = ;const cloneResponse = ;http;
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:
const clone1 = ;const clone2 = ;// 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.
Returns a clone of the passed in response.
A Node.js HTTP response stream to clone.
MIT © Luke Childs