#zlib #deflate #encoding #miniz

miniz_oxide

DEFLATE compression and decompression library rewritten in Rust based on miniz

4 releases

0.1.3 Jun 23, 2018
0.1.2 Jan 9, 2018
0.1.1 Oct 28, 2017
0.1.0 Oct 10, 2017

#9 in Compression

Download history 2990/week @ 2018-07-11 3264/week @ 2018-07-18 2567/week @ 2018-07-25 3022/week @ 2018-08-01 3058/week @ 2018-08-08 3759/week @ 2018-08-15 4029/week @ 2018-08-22 3963/week @ 2018-08-29 3464/week @ 2018-09-05 4073/week @ 2018-09-12 3696/week @ 2018-09-19 5041/week @ 2018-09-26 4823/week @ 2018-10-03

11,254 downloads per month
Used in 213 crates (2 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