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 35 apps in this directory
highlight.io
Analytics · Developer Tools · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.
ILLA Builder
Design Tools · Developer Tools · Low Code Platforms
Open-source low-code platform for building internal tools with drag-and-drop UI, reactive data bindings, and real-time collaboration.
ktx
AI Development · Analytics · Data Engineering
ktx builds a self-improving context layer over your data warehouse so AI agents like Claude Code and Codex query it with approved metric definitions instead of reinventing SQL logic from scratch.
Latitude
AI Agents · Monitoring
Open-source AI agent monitoring that catches what will break next before your users do.
LobeHub
AI Assistants · Automation · Productivity
Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.
n8n
Automation · No Code Platforms
Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.
Nanobrowser
AI Assistants · Automation · Productivity
Open-source Chrome extension for AI-powered web automation — run multi-agent browser workflows locally using your own LLM API keys, free from cloud subscriptions.
NocoDB
Databases · Low Code Platforms · No Code Platforms
Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.
Notesnook
File Storage · Note Taking · Security
End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.