Socket
Socket
Sign inDemoInstall

decompress-response

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    decompress-response

Decompress a HTTP response if needed


Version published
Maintainers
1
Install size
9.05 kB
Created

Package description

What is decompress-response?

The decompress-response npm package is used to decompress HTTP responses that are compressed. This is useful when making HTTP requests and the server responds with compressed data, such as gzip or deflate. The package automatically detects the encoding and decompresses the response so that it can be easily processed in its uncompressed form.

What are decompress-response's main functionalities?

Decompressing HTTP responses

This code sample demonstrates how to use decompress-response to decompress an HTTP response. The 'http.get' method is used to make a GET request to a server. The response is then passed through the decompressResponse function, which returns a stream with the decompressed response. Finally, the decompressed data is piped to the standard output.

const http = require('http');
const decompressResponse = require('decompress-response');

http.get('http://example.com', (res) => {
  res = decompressResponse(res);
  res.pipe(process.stdout);
});

Other packages similar to decompress-response

Readme

Source

decompress-response Build Status

Decompress a HTTP response if needed

Decompresses the response from http.request if it's gzipped or deflated, otherwise just passes it through.

Used by got.

Install

$ npm install decompress-response

Usage

const http = require('http');
const decompressResponse = require('decompress-response');

http.get('http://sindresorhus.com', response => {
	response = decompressResponse(response);
});

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 02 Jun 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc