#zlib #deflate #encoding #miniz

miniz_oxide

DEFLATE compression and decompression library rewritten in Rust based on miniz

12 releases

✓ Uses Rust 2018 edition

0.3.3 Oct 5, 2019
0.3.0 Jul 22, 2019
0.2.1 Jan 23, 2019
0.2.0 Oct 16, 2018
0.1.1 Oct 28, 2017

#2 in Compression

Download history 41426/week @ 2019-06-22 44132/week @ 2019-06-29 41361/week @ 2019-07-06 41220/week @ 2019-07-13 49577/week @ 2019-07-20 48699/week @ 2019-07-27 50772/week @ 2019-08-03 61149/week @ 2019-08-10 55561/week @ 2019-08-17 55461/week @ 2019-08-24 54891/week @ 2019-08-31 55437/week @ 2019-09-07 59892/week @ 2019-09-14 60513/week @ 2019-09-21 69279/week @ 2019-09-28

234,288 downloads per month
Used in 1,350 crates (8 directly)

MIT license

190KB
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