
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
mimic-response
Advanced tools
Mimic a Node.js HTTP response stream
$ npm install mimic-response
import {PassThrough as PassThroughStream} from 'node:stream';
import mimicResponse from 'mimic-response';
const responseStream = getHttpResponseStream();
const myStream = new PassThroughStream();
mimicResponse(responseStream, myStream);
console.log(myStream.statusCode);
//=> 200
Note #1: The from.destroy(error) function is not proxied. You have to call it manually:
import {PassThrough as PassThroughStream} from 'node:stream';
import mimicResponse from 'mimic-response';
const responseStream = getHttpResponseStream();
const myStream = new PassThroughStream({
destroy(error, callback) {
responseStream.destroy();
callback(error);
}
});
myStream.destroy();
Please note that myStream and responseStream never throw. The error is passed to the request instead.
Type: Stream
Type: Stream
Any stream.
The clone-response package is similar to mimic-response in that it is used to clone the response object of a Node.js HTTP response. However, clone-response creates a clone of the response stream that can be read again, while mimic-response copies the properties without creating a new readable stream.
The responselike package is designed to create an object that mimics the Node.js response object. It is similar to mimic-response but is used to create a new response-like object from scratch rather than copying properties from an existing response object.
FAQs
Mimic a Node.js HTTP response stream
The npm package mimic-response receives a total of 35,027,252 weekly downloads. As such, mimic-response popularity was classified as popular.
We found that mimic-response demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.