# decompress-response

> Decompress a HTTP response if needed

Latest version **10.0.0** (published 2025-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install decompress-response
pnpm add decompress-response
yarn add decompress-response
bun add decompress-response
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 10.0.0 |
| Published | 2025-10-13 |
| First published | 2017-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | decompress, response, http, https, zlib, gzip, zip, deflate, unzip, ungzip, incoming, message, stream, compressed, brotli, zstd, zstandard |

## Links

- npm: https://www.npmjs.com/package/decompress-response
- Repository: https://github.com/sindresorhus/decompress-response
- Homepage: https://github.com/sindresorhus/decompress-response#readme
- Issues: https://github.com/sindresorhus/decompress-response/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/decompress-response

## Dependencies (1)

- [mimic-response](https://npm.io/package/mimic-response.md) ^4.0.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 10.0.0 (latest) — 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

## README

# decompress-response

> Decompress a HTTP response if needed

Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped, deflated or compressed with Brotli, otherwise just passes it through.

Used by [`got`](https://github.com/sindresorhus/got).

## Install

```sh
npm install decompress-response
```

## Usage

```js
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`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)

The HTTP incoming stream with compressed data.

---
_Source: https://npm.io/package/decompress-response · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
