Skip to content
Decompress a HTTP response if needed
Branch: master
Clone or download
Latest commit a12b4c8 Mar 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.editorconfig
.gitattributes
.gitignore
.npmrc
.travis.yml
index.d.ts
index.js
index.test-d.ts Add TypeScript definition (#16) Mar 11, 2019
license
package.json
readme.md Add TypeScript definition (#16) Mar 11, 2019

readme.md

decompress-response Build Status

Decompress a HTTP response if needed

Decompresses the response from http.request if it's gzipped, deflated or compressed with Brotli, 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('https://sindresorhus.com', response => {
	response = decompressResponse(response);
});

API

decompressResponse(response)

Returns the decompressed HTTP response stream.

response

Type: http.IncomingMessage

The HTTP incoming stream with compressed data.

License

MIT © Sindre Sorhus

You can’t perform that action at this time.