#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

#4 in Compression

Download history 10029/week @ 2018-11-11 8943/week @ 2018-11-18 9492/week @ 2018-11-25 10897/week @ 2018-12-02 16254/week @ 2018-12-09 16781/week @ 2018-12-16 11318/week @ 2018-12-23 12103/week @ 2018-12-30 14652/week @ 2019-01-06 14203/week @ 2019-01-13 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

51,577 downloads per month
Used in 729 crates (4 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