Decompress-response is a focused utility package designed to automatically decompress HTTP `IncomingMessage` streams based on their `Content-Encoding` header. It supports common compression algorithms including `gzip`, `deflate`, `brotli`, and `zstd` (added in v10.0.0). Currently at stable version 10.0.0, released in late 2023, the package follows a release cadence tied to Node.js LTS updates, with major versions often introducing increased Node.js engine requirements. A key differentiator is its straightforward, single-function API that transforms an `http.IncomingMessage` stream into a decompressed stream, making it easy to integrate. It is notably used internally by popular HTTP client libraries like `got` and operates as a pure ECMAScript Module (ESM) package since version 8, requiring modern JavaScript module syntax for usage.
npm install decompress-responseVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to set up a basic Node.js server that sends a gzipped response, and then how a client can use `decompress-response` to automatically decompress and consume the HTTP stream.
Upgrade your Node.js runtime to version 20 or later, or pin `decompress-response` to version `^9.0.0` or `<10`.
Upgrade your Node.js runtime to version 18 or later, or pin `decompress-response` to version `^8.0.0` or `<9`.
Migrate your project to ESM by setting `"type": "module"` in your `package.json` or by using `.mjs` file extensions, and update all imports to use `import decompressResponse from 'decompress-response';`.
Upgrade your Node.js runtime to version 12.20.0 or later, or pin `decompress-response` to version `^7.0.0` or `<8`.
Adjust any logic that inspects the `content-encoding` header on the *returned* stream. The header should be checked on the *original* `response` object if needed.
For versions 5.x to 7.x, adjust TypeScript imports. For v8.0.0 and above, revert to the standard `import` statement for ESM compatibility.
Upgrade to v9.0.0 or later to ensure the original `http.IncomingMessage` stream is not unintentionally modified. If on an older version, treat the original `response` object as potentially altered after calling `decompressResponse`.
Convert your consuming file or project to use ECMAScript Modules (ESM) syntax (`import decompressResponse from 'decompress-response';`) and ensure your `package.json` includes `"type": "module"` or your file uses a `.mjs` extension.
Ensure you are using the correct default import: `import decompressResponse from 'decompress-response';`. For older TypeScript versions (5.x-7.x), check if the `import decompressResponse = require('decompress-response');` syntax is required by your specific setup.Upgrade your Node.js runtime to version 10 or newer. For `decompress-response` v10.x, Node.js 20 or newer is required.
No dependency data recorded yet.