Registry / utility / flate2

flate2

JSON →
library1.1.9rscratesunverified

DEFLATE compression and decompression exposed as Read/BufRead/Write streams, supporting zlib, gzip, and raw deflate.

# Cargo.toml [dependencies] flate2 = "1.1.9"
INSTALL
IMPORT
SIG · FLATE2
F
flate2
utilityrustv1.1.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GzDecoder
✓ use flate2::read::GzDecoder;

Decompress gzip data using a streaming decoder.

use flate2::read::GzDecoder; use std::io::Read; fn main() -> std::io::Result<()> { let compressed = vec![31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 243, 72, 205, 201, 201, 87, 8, 207, 47, 202, 73, 81, 4, 0, 162, 240, 82, 179, 12, 0, 0, 0]; let mut decoder = GzDecoder::new(&compressed[..]); let mut s = String::new(); decoder.read_to_string(&mut s)?; println!("{}", s); Ok(()) }
Debug
Known issues
gotchaDefault backend uses `miniz_oxide`; for better performance, enable `zlib` feature with a C library.
fix
Add `features = ["zlib"]` to Cargo.toml and install zlib development files.
affects: >=1.0.0
Upgrade
Version history
1.1.9latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
flate2 — cargo add flate2 · libregistry