3 [![Crates.io](https://img.shields.io/crates/v/flate2.svg?maxAge=2592000)](https://crates.io/crates/flate2)
4 [![Documentation](https://docs.rs/flate2/badge.svg)](https://docs.rs/flate2)
6 A streaming compression/decompression library DEFALTE-based streams in Rust.
8 This crate by default implemented as a wrapper around the `miniz_oxide` crate, a
9 port of `miniz.c` to Rust. This crate can also optionally use the zlib library
24 Using zlib instead of the Rust backend:
28 flate2 = { version = "1.0", features = ["zlib"], default-features = false }
35 flate2 = { version = "1.0", features = ["miniz-sys"], default-features = false }
41 use std::io::prelude::*;
42 use flate2::Compression;
43 use flate2::write::ZlibEncoder;
46 let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
49 let compressed_bytes = e.finish();
56 use std::io::prelude::*;
57 use flate2::read::GzDecoder;
60 let mut d = GzDecoder::new("...".as_bytes());
61 let mut s = String::new();
62 d.read_to_string(&mut s).unwrap();
69 This project is licensed under either of
71 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
72 http://www.apache.org/licenses/LICENSE-2.0)
73 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
74 http://opensource.org/licenses/MIT)
80 Unless you explicitly state otherwise, any contribution intentionally submitted
81 for inclusion in this project by you, as defined in the Apache-2.0 license,
82 shall be dual licensed as above, without any additional terms or conditions.