npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

mimic-response

2.0.0 • Public • Published

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.

Related

License

MIT © Sindre Sorhus

install

npm i mimic-response

Downloadsweekly downloads

2,470,959

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability