sonia-js/node_modules/mimic-response
2024-07-20 14:47:23 -06:00
..
index.js init 2023-03-30 09:45:31 +00:00
license init 2023-03-30 09:45:31 +00:00
package.json a 2024-07-20 14:47:23 -06:00
readme.md init 2023-03-30 09:45:31 +00: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