neuron-explorer
Steering-first neuron explorer for Qwen3.5-4B: push every MLP neuron, keep every rollout, browse the results
Try Rust-powered zstd, gzip, brotli, and lz4 compression live in your browser. No install needed.
Developer toolsTypeScript · RustGitHub @derodero24OnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Rust-powered universal compression for JavaScript/TypeScript. zstd, gzip, brotli, and lz4 in one package.
Taken from the repository README
Loading the full README.
Read the full README ↗zstd, brotli, gzip and LZ4 for JavaScript, with one API. Native Rust code in Node.js, Deno and Bun; WebAssembly in the browser.
Documentation · Playground · API reference
CompressionStream.browser condition, with the same functions.compress() and decompress() take an options object. There is a CompressionStream ponyfill for every format, AbortSignal support, and an error code you can switch on.| Feature | comprs | pako | fflate | node:zlib |
|---|---|---|---|---|
| zstd | ✅ | ❌ | ❌ | ⚠️ Experimental (Node.js 22.15+) |
| gzip / deflate | ✅ | ✅ | ✅ | ✅ |
| brotli | ✅ | ❌ | ❌ | ✅ |
| LZ4 | ✅ | ❌ | ❌ | ❌ |
| Web Streams | ✅ | ❌ | ❌ | ❌ |
| Node.js Transform | ✅ | ❌ | ❌ | ✅ |
| Browsers | ✅ | ✅ | ✅ | ❌ |
| Deno and Bun | ✅ | ✅ | ✅ | ✅ |
| Native performance | ✅ | ❌ | ❌ | ✅ |
| Dictionaries | zstd, brotli | deflate | deflate | deflate; zstd (Node.js 22.19+, 24.6+) |
| JavaScript dependencies | none | none | none | none |
pako uses chunked Inflate and Deflate classes rather than Web Streams. Deno 2 and Bun implement node:zlib. The migration guides map the APIs of pako, fflate, node:zlib, brotli-wasm and @mongodb-js/zstd to comprs.
npm install @derodero24/comprs
comprs needs Node.js 22 or newer. The package manager installs the native binary for your platform as an optional dependency, and bundlers for browsers pick the WebAssembly build (see Browsers).
The unified API of @derodero24/comprs/next takes the format as an option and returns a Uint8Array:
import { compress, compressSync, decompress, decompressSync } from '@derodero24/comprs/next';
const data = new TextEncoder().encode('Hello, comprs!');
// On the libuv thread pool in Node.js, Deno and Bun
const zstd = await compress(data, { format: 'zstd', level: 19 });
const restored = await decompress(zstd); // detects the format
// On the calling thread, with a limit for untrusted input
const gzip = compressSync(data, { format: 'gzip' });
decompressSync(gzip, { format: 'gzip', maxOutputSize: 1024 * 1024 });
Streams work like the standard CompressionStream and DecompressionStream, in every format:
import { CompressionStream, DecompressionStream } from '@derodero24/comprs/next';
const file = new Blob(['Hello, comprs! '.repeat(1000)]);
const compressed = file.stream().pipeThrough(new CompressionStream('zstd', { level: 9 }));
const restored = compressed.pipeThrough(
new DecompressionStream('auto', { maxOutputSize: 10 * 1024 * 1024 }),
);
console.log(await new Response(restored).text());
For a page that needs one format, @derodero24/comprs/next/zstd, /gzip, /brotli and /lz4 export the same API for one family of formats, with a WebAssembly build of that family alone: 42 KB to 337 KB gzipped, against 568 KB for every format (see Browsers).
The errors that comprs raises have a stable code, such as ERR_COMPRS_SIZE_LIMIT or ERR_COMPRS_TRUNCATED (see Errors and limits).
The package root, @derodero24/comprs, has a function for each format instead, such as zstdCompress(data, level) and gzipDecompressAsync(data), which return a Node.js Buffer in the native addon, along with stream contexts and Node.js Transform streams (see Classic API). Both APIs are supported and write the same bytes at the same settings.
The website has the full documentation:
| Runtime | Backend |
|---|---|
| Node.js 22 or newer | Native addon (napi-rs) |
| Deno | Native addon, with --allow-ffi and a local node_modules |
| Bun | Native addon |
| Browsers | WebAssembly (wasm-bindgen) |
Prebuilt binaries cover macOS (x64, ARM64), Linux (x64, ARM64, with glibc 2.17 or newer, or musl) and Windows (x64, ARM64). Platforms has the details, the size of the WebAssembly build, and what happens on other platforms.
Measured on x86-64 Linux with Node.js 24, with every library at the same settings: comprs decompresses zstd 1.4–3.6 times and gzip 1.0–2.0 times as fast as node:zlib, and gzip 3.5–16 times as fast as pako. Its brotli comes from libbrotli, the C library of node:zlib: it compresses at about the same speed and decompresses up to 1.5 times as fast. The Benchmarks page of the website has the takeaways and the tables, with compression ratios, by library, format, direction and input. Run the benchmarks locally with pnpm run bench; numbers vary by machine and data. CodSpeed tracks the Rust benchmarks of comprs-core on the pull requests that change Rust code, to catch performance regressions.
@derodero24/comprs-middlewareHTTP compression middleware for Express, Fastify, and Hono.
npm install @derodero24/comprs @derodero24/comprs-middleware
// Express
import { comprs } from '@derodero24/comprs-middleware/express';
app.use(comprs());
// Fastify
import { comprs } from '@derodero24/comprs-middleware/fastify';
app.register(comprs);
// Hono
import { comprs } from '@derodero24/comprs-middleware/hono';
app.use(comprs());
See the middleware README for every option, and Servers for decompressing request bodies.
See CONTRIBUTING.md for development setup and guidelines.
See SECURITY.md for vulnerability reporting.
The npm packages also include THIRD_PARTY_LICENSES, with the licenses of the Rust crates and of the zstd C library that the native addon and the WebAssembly build link statically.