#zlib #deflate #encoding #miniz

miniz_oxide

DEFLATE compression and decompression library rewritten in Rust based on miniz

6 releases

0.2.1 Jan 23, 2019
0.2.0 Oct 16, 2018
0.1.3 Jun 23, 2018
0.1.2 Jan 9, 2018
0.1.1 Oct 28, 2017

#11 in Compression

Download history 16784/week @ 2019-01-20 16585/week @ 2019-01-27 17291/week @ 2019-02-03 19756/week @ 2019-02-10 18660/week @ 2019-02-17 20906/week @ 2019-02-24 20767/week @ 2019-03-03 21764/week @ 2019-03-10 22088/week @ 2019-03-17 26720/week @ 2019-03-24 28308/week @ 2019-03-31 33474/week @ 2019-04-07 32192/week @ 2019-04-14 39025/week @ 2019-04-21 33065/week @ 2019-04-28

51,577 downloads per month
Used in 862 crates (3 directly)

MIT license

172KB
3.5K SLoC

miniz_oxide

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:


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!");
}

TODO: Advanced functions.


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