#zlib #deflate #encoding #miniz


DEFLATE compression and decompression API designed to be Rust drop-in replacement for miniz

10 releases

Uses old Rust 2015

0.2.5 Mar 1, 2020
0.2.4 Oct 1, 2019
0.2.3 Jul 22, 2019
0.2.1 Jan 23, 2019
0.1.1 Oct 28, 2017

#52 in Compression

Download history 5327/week @ 2020-04-22 4089/week @ 2020-04-29 3830/week @ 2020-05-06 3429/week @ 2020-05-13 3247/week @ 2020-05-20 3075/week @ 2020-05-27 3396/week @ 2020-06-03 3348/week @ 2020-06-10 3435/week @ 2020-06-17 3152/week @ 2020-06-24 2528/week @ 2020-07-01 2737/week @ 2020-07-08 2244/week @ 2020-07-15 2715/week @ 2020-07-22 2490/week @ 2020-07-29 2563/week @ 2020-08-05

28,064 downloads per month

MIT license


Rust 5K SLoC // 0.2% comments C 4K SLoC // 0.4% comments


Rust replacement for the miniz deflate/zlib encoder/decoder

This project is organized into a C API shell and a rust crate. The Rust crate is found in the miniz_oxide subdirectory.

As of version 0.3, miniz_oxide requires at least rust 1.34 to compile.

For a friendlier streaming API using readers and writers, flate2 can be used, which can use miniz_oxide as a rust-only back-end.


The C API is intented to replicate the api exported from miniz.

NOTE for usage from C: Using from C is currently partly broken as the data structures no longer have the exact same layout that is specified in miniz.h (from the original miniz). Automated headers with CBindgen currently do not work due to an issue in cbindgen, which needs to be fixed worked around so that a proper header can be generated. As such, treat them as opaque pointers, that should be allocated and operated on only by the exported functions.

API documentation



$ cargo test
$ ./test.sh


$ cargo bench --features=benching

or to compare to miniz

$ ./travis-after-success.sh

Including in C/C++ projects

Link against the libminiz_oxide_c_api.a generated by build.sh

Cargo-fuzz testing

Install fuzzer:

$ cargo install cargo-fuzz

Run fuzzer:

$ ./run_fuzz.sh


This library (excluding the miniz C code used for tests) is licensed under the MIT license. The library is based on the miniz C library, of which the parts used are dual-licensed under the MIT license and also the unlicense. The parts of miniz that are not covered by the unlicense is some Zip64 code which is only MIT licensed. This and other Zip functionality in miniz is not part of the miniz_oxidde and miniz_oxide_c_api rust libraries.