Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mimic-response

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mimic-response

Mimic a Node.js HTTP response stream

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32M
increased by10.52%
Maintainers
1
Weekly downloads
 
Created

What is mimic-response?

The mimic-response npm package is designed to copy properties from one response-like object to another. This is particularly useful when you are working with streams and you want to retain the original response properties after modifying or replacing the response stream.

What are mimic-response's main functionalities?

Copying response properties

This feature allows you to copy properties from an HTTP response object to another stream. In this code sample, an HTTP GET request is made, and the response is piped through a new PassThrough stream, but before that, all properties of the original response are copied to the new stream using mimicResponse.

const http = require('http');
const mimicResponse = require('mimic-response');

http.get('http://example.com', (res) => {
  const customResponse = new stream.PassThrough();
  mimicResponse(res, customResponse);
  res.pipe(customResponse);
});

Other packages similar to mimic-response

Keywords

FAQs

Package last updated on 17 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc