fflate
High-performance DEFLATE, GZIP, Zlib, and ZIP compression for JavaScript in an 8kB package.
Repository Health
Technical Analysis
fflate (fast flate) is a pure-JavaScript compression and decompression library that delivers the speed of native code in a fraction of the bundle size. It supports DEFLATE, GZIP, Zlib, and ZIP formats, works identically in the browser and Node.js, and produces output fully interoperable with standard tools like zlib and gzip.
Despite weighing roughly 8kB minified (as little as 3kB for inflate-only builds), fflate outperforms popular alternatives such as pako, UZIP.js, and tiny-inflate on both compression ratio and throughput. It adds streaming APIs, multi-threaded asynchronous compression via Web Workers, dictionary support, and ZIP archiving without pulling in any dependencies.
What You Get
- Synchronous one-shot helpers (gzipSync, unzlibSync, decompressSync) for quick compression and decompression of Uint8Array data
- Streaming classes (Gzip, Inflate, Deflate, Decompress) that process data incrementally chunk by chunk
- Asynchronous, multi-threaded variants that offload work to Web Workers for up to 3x throughput on large payloads
- Full ZIP archiving and extraction, including nested directories, per-file options, and streaming ZIP support
- String and UTF-8 conversion utilities (strToU8, strFromU8, EncodeUTF8, DecodeUTF8) plus automatic format detection
Common Use Cases
- Compressing API payloads or uploads in the browser before sending them over the network
- Reading and writing ZIP archives client-side without a server round-trip
- Decompressing GZIP/Zlib assets fetched at runtime while keeping the bundle tiny
- Streaming compression of large files that would not fit comfortably in memory
Under The Hood
Architecture
The entire library lives in a single, densely optimized src/index.ts (~121kB of source) that implements the DEFLATE algorithm from RFC 1951 directly against typed arrays. Core lookup tables (fleb, fdeb, clim, precomputed Huffman reverse tables) are built once at module load, and the compressor/decompressor operate on Uint8Array/Uint16Array/Int32Array buffers to stay allocation-light. Higher-level format wrappers (GZIP, Zlib, ZIP) layer headers and checksums over the shared DEFLATE core, while streaming is modeled as stateful classes with an ondata(chunk, final) callback. Asynchronous variants (src/node-worker.ts, src/worker.ts) marshal work onto Web Workers / worker threads to parallelize compression.
Tech Stack
Written entirely in TypeScript (100% of the codebase) with zero runtime dependencies. It compiles to CommonJS, ESM, and UMD bundles via tsc plus a Terser minification step, with a Parcel-built browser demo. Package exports are carefully mapped in package.json to serve node/browser and import/require conditions with matching type declarations, and sideEffects: false enables aggressive tree-shaking.
Code Quality
The repo ships a substantial uvu-based test suite under test/ covering validity, bundle size, performance, ZIP handling, streams, and async modes (files 0-valid.ts through 5-async.ts). Benchmarks compare fflate against pako, UZIP.js, and tiny-inflate. The source trades readability for extreme performance and size — heavily aliased identifiers and bit-twiddling — but is annotated with references to the underlying RFCs and design notes.
API Design
The public API is ergonomic and consistent: paired *Sync and streaming/async variants share option shapes (level, mem, filename, mtime), and format detection (decompressSync, Decompress) removes guesswork. Named exports let consumers import only what they need, and the typedoc-generated reference under docs/ documents every function, class, and interface. Getting started requires only a Uint8Array and a single call.
Used by 31 apps in this directory
Actual
Invoicing Finance
Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
agenta
Developer Tools · Devops · AI Development
The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Bramble
Password Manager · Security · Authentication
Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.
Bun
Developer Tools
An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.
Epicenter
Knowledge Management · Note Taking · Developer Tools
A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.
fabro
Developer Tools · Devops
Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.
highlight.io
Developer Tools · Analytics · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.