A Rust implementation of DEFLATE algorithm and related formats (ZLIB, GZIP).
The documentation includes some examples.
Add following lines to your Cargo.toml
:
toml
[dependencies]
libflate = "0.1"
Below is a command to decode GZIP stream that is read from the standard input: ```rust extern crate libflate;
use std::io; use libflate::gzip::Decoder;
fn main() { let mut input = io::stdin(); let mut decoder = Decoder::new(&mut input).unwrap(); io::copy(&mut decoder, &mut io::stdout()).unwrap(); } ```
A brief comparison with flate2: ```bash $ cd libflate/flate_bench/ $ curl -O https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz $ gzip -d enwiki-latest-all-titles-in-ns0.gz $ ls -lh enwiki-latest-all-titles-in-ns0 -rw-rw-rw- 1 foo foo 257M 10月 3 17:22 enwiki-latest-all-titles-in-ns0
$ cargo run --release -- enwiki-latest-all-titles-in-ns0