Inflate

A pure Rust implementation of DEFLATE and zlib decompression

Library
Cargo
v0.4.5
45stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
24/100Needs Attention
Development Activity0
Maintenance0
Community24
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture74
Code Quality72
Innovation60
Learning Curve85

Inflate is a pure Rust library that decompresses data encoded with the DEFLATE algorithm, both with and without a zlib header and trailer. It has no C dependencies and provides simple helper functions to turn compressed bytes back into a decoded byte vector.

The crate exposes several levels of control: one-shot helpers like inflate_bytes and inflate_bytes_zlib, a std::io::Write-based InflateWriter for streaming decompression, and lower-level building blocks for advanced use. Long a foundational dependency for image and archive tooling in the Rust ecosystem, it is distributed under the permissive MIT license.

What You Get

  • One-shot decompression via inflate_bytes and inflate_bytes_zlib
  • A streaming InflateWriter implementing std::io::Write
  • Support for both raw DEFLATE and zlib-wrapped input
  • A dependency-light, pure-Rust implementation with no C bindings

Common Use Cases

  • Decompressing DEFLATE streams inside image decoders such as PNG
  • Reading zlib-compressed payloads from files or network protocols
  • Building archive or format parsers that need raw inflate support
  • Decoding compressed data in constrained or portable Rust builds

Under The Hood

Architecture - Inflate implements the DEFLATE decoder as a state machine over a bit reader, exposing three tiers: convenience functions (inflate_bytes, inflate_bytes_zlib), an InflateWriter adapter that implements std::io::Write and buffers into an inner writer, and lower-level primitives for custom decoding loops.

Tech Stack - Written entirely in Rust with the adler32 crate for zlib checksum verification and no C dependencies, distributed as the inflate crate on crates.io.

Code Quality - A small, focused codebase with example-driven documentation in the README; it is mature and battle-tested through wide downstream use, though development has been largely inactive since 2019.

API Design - The API is minimal and approachable: a single function call handles the common case, while the writer and lower-level APIs offer progressively more control for streaming and advanced scenarios.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search