Registry / http-networking / compress

compress

JSON →
library0.99.0jsnpmunverified

Compress is a Node.js middleware for HTTP message compression, supporting gzip, deflate, and brotli encodings. The current stable version is 0.99.0, with infrequent releases. It differs from alternatives like compression by focusing on simplicity and low overhead, but is less actively maintained. Suitable for compressing HTTP responses in Express/Connect apps.

npm install compress
INSTALL
IMPORT
SIG · COMPRESS
C
compress
http-networkingjavascriptv0.99.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compress
import compress from 'compress'
const compress = require('compress')
ESM default import; no named exports.
compress
const compress = require('compress').default
const compress = require('compress')
CJS require pattern; the default export is on .default property.
compressObj
import { compressObj } from 'compress'
const { compress } = require('compress')
If the package exposes compressObj as a named export (check docs).

Creates an HTTP server that compresses responses using the compress middleware.

import compress from 'compress'; import http from 'http'; const server = http.createServer((req, res) => { compress(req, res, () => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello, World!'); }); }); server.listen(3000, () => { console.log('Server running on port 3000'); });
Debug
Known issues
deprecatedcompress 0.x is not actively maintained; consider alternatives like compression.
fix
Migrate to the 'compression' npm package for better maintenance.
affects: >=0.0.0
gotchaThe compress function expects an HTTP response with a writable stream; fails if used improperly.
fix
Ensure the response object has writable stream methods (e.g., from http.createServer).
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: compress is not a function
Incorrect default import in CommonJS environment.
fix
Use `const compress = require('compress').default;`
Upgrade
Version history
0.99.0latest on npm
Audit
Dependencies
zliboptionalnative Node.js compression module used for gzip/deflate/brotli
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
compress — npm install compress · libregistry