#zlib #deflate #encoding #miniz

miniz_oxide

DEFLATE compression and decompression library rewritten in Rust based on miniz

14 releases

✓ Uses Rust 2018 edition

0.3.6 Feb 3, 2020
0.3.5 Oct 27, 2019
0.3.2 Aug 11, 2019
0.3.0 Jul 22, 2019
0.1.1 Oct 28, 2017

#9 in Compression

Download history 93124/week @ 2019-12-14 57066/week @ 2019-12-21 63615/week @ 2019-12-28 92218/week @ 2020-01-04 99194/week @ 2020-01-11 97945/week @ 2020-01-18 101938/week @ 2020-01-25 111550/week @ 2020-02-01 108637/week @ 2020-02-08 100256/week @ 2020-02-15 103213/week @ 2020-02-22 109478/week @ 2020-02-29 108416/week @ 2020-03-07 104803/week @ 2020-03-14 112856/week @ 2020-03-21 100445/week @ 2020-03-28

377,525 downloads per month
Used in 1,650 crates (10 directly)

MIT license

195KB
4K SLoC

miniz_oxide

A pure rust replacement for the miniz DEFLATE/zlib encoder/decoder. The main intention of this crate is to be used as a back-end for the flate2, but it can also be used on it's own. Using flate2 with the rust_backend feature provides an easy to use streaming API for miniz_oxide.

Requires at least rust 1.34.

Usage

Simple compression/decompression:


extern crate miniz_oxide;

use miniz_oxide::inflate::decompress_to_vec;
use miniz_oxide::deflate::compress_to_vec;

fn roundtrip(data: &[u8]) {
    let compressed = compress_to_vec(data, 6);
    let decompressed = decompress_to_vec(decompressed.as_slice()).expect("Failed to decompress!");
}


lib.rs:

A pure rust replacement for the miniz DEFLATE/zlib encoder/decoder. The plan for this crate is to be used as a back-end for the flate2 crate and eventually remove the need to depend on a C library.

Usage

Simple compression/decompression:


use miniz_oxide::inflate::decompress_to_vec;
use miniz_oxide::deflate::compress_to_vec;

fn roundtrip(data: &[u8]) {
    let compressed = compress_to_vec(data, 6);
    let decompressed = decompress_to_vec(compressed.as_slice()).expect("Failed to decompress!");
#   let _ = decompressed;
}

# roundtrip(b"Test_data test data lalalal blabla");

Dependencies