Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
JavaScript compression libraries shrink bytes and strings with formats such as gzip, DEFLATE, and Brotli. An archive format such as ZIP or tar bundles many files into one container with each file compressed inside it. These libraries reduce the size of API responses, file exports, and values kept in browser storage.
Popularity
pako has the most monthly downloads in this comparison, at 714.9M.
append(content: string | Uint8Array, options: ZipArchiveEntryOptions) {
if (this.#error) {
throw this.#error;
}
// A Buffer view over the same memory rather than a copy; archiver only reads, so sharing is safe. const payload = typeof content === "string" ? content : asBuffer(content);
const size = typeof content === "string" ? Buffer.byteLength(content) : content.byteLength;
this.#pendingSizes.push(size);
this.#queuedBytes += size;
// `store` (and `date`) pass straight through: archiver preserves extra // entry-data fields and zip-stream switches to the STORE method when set. this.#archive.append(payload, options);
}
compression
Compresses HTTP response bodies in Node.js with deflate, gzip, or Brotli.
Downloads / mo
238.9M
Stars
2.8K
Last release
1.8.2
License
MIT
Strengths
Accepts zlib options.zlib and Brotli settings pass through the options object.
Limitations
Skips no-transform responses.Responses with a Cache-Control no-transform header go out uncompressed.
async startHttpServer() {
this.app = this.express();
const compression = require('compression');
this.app.use(
compression({
filter(req, res) {
let type = res.getHeader('Content-Type');
if (res.getHeader('x-no-compression')) {
// don't compress responses with this response header return false;
} else if (type && type.indexOf('text/event-stream') > -1) {
// don't attempt to compress server sent events return false;
} else {
return compression.filter(req, res);
}
},
})
);
this.setupHttpServer();
let options = this.startOptions;
options.httpServer = this.httpServer;
let liveReloadServer;
if (options.path) {
liveReloadServer = {
setupMiddleware() {},
};
} else {
liveReloadServer = new LiveReloadServer({
app: this.app,
ui: options.ui,
watcher: options.watcher,
project: options.project,
httpServer: options.httpServer,
});
}
const config = this.project.config(options.environment);
const middlewareOptions = Object.assign({}, options, {
rootURL: config.rootURL,
});
await liveReloadServer.setupMiddleware(this.startOptions);
await this.processAppMiddlewares(middlewareOptions);
await this.processAddonMiddlewares(middlewareOptions);
return this.listen(options.port, options.host).catch(() => {
throw new SilentError(
`Could not serve on http://${this.displayHost(options.host)}:${options.port}. ` +
`It is either in use or you do not have permission.`
);
});
}
FAQ
JSZip creates, reads, and edits ZIP files from JavaScript. Each file in the archive can set its own DEFLATE compression level.
lz-string compresses JavaScript strings for browser storage and URLs. Use compressToUTF16 for UTF-16-safe stored strings.
pako and fflate compress bytes and strings to gzip in the browser and in Node.js. In an Express server, the compression middleware gzips response bodies instead.
tar creates and extracts tar archives in Node.js with an API modeled on the Unix tar command.
fflate warns about worker startup overhead and slower async APIs on small payloads.
Its own missing-function list includes deflateParams; choose required settings before starting the stream.
For coding agents
Found your compression library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.