zstd

Idiomatic Rust bindings for the Zstandard compression library

Library
Cargo
v0.14.0
657 stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
83 /100 Excellent
Development Activity 84
Maintenance 84
Community 76
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
70 /100 Good
Architecture 75
Code Quality 70
Innovation 68
Learning Curve 65

zstd provides safe, idiomatic Rust bindings around Facebook’s Zstandard (zstd) compression library, exposing Read/Write stream wrappers alongside simple one-shot encode/decode helper functions. It builds on the lower-level zstd-safe and zstd-sys crates in the same workspace, compiling the vendored C library as part of the build so consumers get zstd compression without needing a system dependency.

The crate is one of the most widely used compression bindings in the Rust ecosystem, powering compression layers in databases, build tools, and network protocols where zstd’s balance of speed and ratio is preferred over gzip or bzip2.

What You Get

  • Streaming Encoder/Decoder types implementing standard Read/Write traits
  • One-shot helper functions (encode_all, decode_all, copy_encode, copy_decode)
  • Dictionary training and dictionary-based compression via the zdict_builder feature
  • Multi-threaded compression support via the zstdmt feature
  • Optional bindgen-based binding regeneration and a pkg-config feature to link a system zstd

Common Use Cases

  • Compressing log files, backups, or build artifacts before storage or transfer
  • Adding transparent zstd compression to a custom network protocol or RPC layer
  • Compressing/decompressing data streams inside a CLI tool (mirrors the zstd/zstdcat examples in the repo)
  • Training a shared dictionary to improve compression ratio on many small, similar payloads

Under The Hood

Architecture — The repository is a small Cargo workspace: the top-level zstd crate (this package) provides ergonomic Read/Write wrappers (src/stream/) and bulk one-shot helpers (src/bulk/) on top of zstd-safe, a safe-but-thin layer that itself wraps zstd-safe/zstd-sys, the raw FFI bindings generated against the vendored zstd C sources (included as a git submodule). This three-tier layering (raw FFI → safe wrapper → ergonomic API) is a common pattern for Rust bindings to C libraries and keeps unsafe code isolated to the -sys crate. Tech Stack — Pure Rust wrapper crate targeting edition 2018 with a 1.64 MSRV; it depends only on zstd-safe (path dependency within the workspace) for the runtime API, with clap, humansize, partial-io, and walkdir as dev-dependencies used by the CLI examples and test harness. The C library itself is compiled from source via a build script in zstd-sys. Code Quality — The crate has a small dedicated tests/ directory plus doctests embedded in the stream/bulk modules, and CI badges show Linux/Windows/macOS/wasm build matrices. Error handling follows the underlying C library’s return-code conventions surfaced as io::Result, which is idiomatic for a Read/Write-based API. API Design — The crate intentionally mirrors std::io::copy-style ergonomics (copy_encode/copy_decode) alongside lower-level Encoder/Decoder types, so users needing a quick one-liner and users needing fine-grained streaming control both have a natural entry point; feature flags (zstdmt, zdict_builder, experimental) keep the default build lean while exposing advanced functionality opt-in.

Used by 11 apps in this directory

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,529

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 67%
Vue 25%
Updated 6 days ago
Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,758

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
82
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated 1 weeks ago
Rust
47%
MIT

Kuku

Note Taking

225

A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.

View details
52
Repo Health
67
Technical
67
Dependency
Built with
Rust 47%
TypeScript 40%
Updated 3 weeks ago
TypeScript
90%
MIT

open-pencil

AI Design Tools · Design Tools

8,642

An open-source design editor that reads native Figma files, ships a built-in AI assistant with 100+ design tools, and offers real-time serverless collaboration — all without giving up your files.

View details
81
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 90%
Updated 6 days ago
Rust
85%
Apache 2.0

OpenShell

AI Agents · Developer Tools

8,811

The safe, private runtime that lets autonomous AI agents operate in sandboxed environments governed by declarative YAML policies — blocking data exfiltration, credential leaks, and unauthorized network activity before they happen.

View details
85
Repo Health
81
Technical
68
Dependency
Built with
Rust 85%
Updated 4 days ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

39,975

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 4 days ago
Java
93%
Apache 2.0

QuestDB

Analytics · Databases

17,360

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
67
Dependency
Built with
Java 93%
Updated 4 days ago
Rust
77%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,041

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
56
Repo Health
84
Technical
63
Dependency
Built with
Rust 77%
TypeScript 20%
Updated 2 months ago

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