decompress-response

Decompress a HTTP response if needed

MIT 14 个版本
安装
npm install decompress-response
yarn add decompress-response
pnpm add decompress-response
bun add decompress-response
README

decompress-response

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

import http from 'node:http';
import decompressResponse from '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.

版本列表
10.0.0 2025-10-13
9.0.0 2024-05-28
8.1.0 2023-02-23
8.0.0 2021-10-27
7.0.0 2021-02-12
6.0.0 2020-05-15
5.0.0 2019-11-01
4.2.1 2019-08-12
4.2.0 2019-03-31
4.1.0 2019-03-11
4.0.0 2019-01-20
3.3.0 2017-06-02
3.2.0 2017-05-07
3.1.0 2017-05-06