notetron/node_modules/mimic-response
2022-03-22 13:49:52 +07:00
..
index.js Start of this 2022-03-22 13:49:52 +07:00
license Start of this 2022-03-22 13:49:52 +07:00
package.json Start of this 2022-03-22 13:49:52 +07:00
readme.md Start of this 2022-03-22 13:49:52 +07:00

mimic-response Build Status

Mimic a Node.js HTTP response stream

Install

$ npm install mimic-response

Usage

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.

to

Type: Stream

Any stream.

License

MIT © Sindre Sorhus