#crc #simd #gzip #zlib


SIMD acceleration for CRC-32 checksums used in the gzip format Deprecated in favor of the crc32fast crate

2 releases

0.1.1 Nov 19, 2018
0.1.0 Nov 19, 2018

#29 in Compression

Download history 2882/week @ 2018-11-20

960 downloads per month


230 lines


Build Status Build status Crates.io Documentation

A streaming compression/decompression library for Rust. The underlying implementation by default uses miniz but can optionally be configured to use the system zlib, if available.

There is also an experimental rust backend that uses the miniz_oxide crate. This avoids the need to build C code, but hasn't gone through as much testing as the other backends.

Supported formats:

  • deflate
  • zlib
  • gzip
# Cargo.toml
flate2 = "1.0"

Using zlib instead of miniz:

flate2 = { version = "1.0", features = ["zlib"], default-features = false }

Using the rust back-end:

flate2 = { version = "1.0", features = ["rust_backend"], default-features = false }


extern crate flate2;

use std::io::prelude::*;
use flate2::Compression;
use flate2::write::ZlibEncoder;

fn main() {
    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
    let compressed_bytes = e.finish();


extern crate flate2;

use std::io::prelude::*;
use flate2::read::GzDecoder;

fn main() {
    let mut d = GzDecoder::new("...".as_bytes());
    let mut s = String::new();
    d.read_to_string(&mut s).unwrap();
    println!("{}", s);


This project is licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.