flate2 0.1.3

Bindings to miniz.c for DEFLATE compression and decompression exposed as Reader/Writer streams. Contains bindings for zlib, deflate, and gzip-based streams.
docs.rs failed to build flate2-0.1.3
Please check the build logs and, if you believe this is docs.rs' fault, open an issue.

flate2

Build Status

Documentation

A streaming compression/decompression library for rust with bindings to miniz

Supported formats:

  • deflate
  • zlib
  • gzip
# Cargo.toml
[dependencies.flate2]
git = "https://github.com/alexcrichton/flate2-rs"

Compression

extern crate flate2;

use std::io::MemWriter;
use flate2::writer::ZlibEncoder;

# #[allow(unused_must_use)]
fn main() {
    let mut e = ZlibEncoder::new(MemWriter::new(), flate2::Default);
    e.write(b"foo");
    e.write(b"bar");
    let compressed_bytes = e.finish();
}

Decompression

extern crate flate2;

use std::io::BufReader;
use flate2::reader::GzDecoder;

fn main() {
    let mut d = GzDecoder::new(BufReader::new(b"..."));
    println!("{}", d.read_to_string());
}

License

flate2-rs is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, and LICENSE-MIT for details.