3 releases

0.1.4 Jun 25, 2021
0.1.3 Sep 16, 2020
0.1.2 Jun 27, 2020
0.1.1 Mar 24, 2020
0.1.0 Mar 24, 2020

#32 in Compression

Download history 10/week @ 2021-04-08 32/week @ 2021-04-15 12/week @ 2021-04-22 95/week @ 2021-04-29 76/week @ 2021-05-06 72/week @ 2021-05-13 265/week @ 2021-05-20 174/week @ 2021-05-27 89/week @ 2021-06-03 412/week @ 2021-06-10 701/week @ 2021-06-17 713/week @ 2021-06-24 686/week @ 2021-07-01 667/week @ 2021-07-08 651/week @ 2021-07-15 450/week @ 2021-07-22

706 downloads per month
Used in swash

MIT/Apache

135KB
3K SLoC

Yazi - Yet another zlib implementation

Yazi is a pure Rust implementation of the RFC 1950 DEFLATE specification with support for the zlib wrapper. It provides streaming compression and decompression.

Crates.io Docs.rs MIT licensed

Usage

Add this to your Cargo.toml:

[dependencies]
yazi = "0.1.4"

The following demonstrates simple usage for compressing and decompressing in-memory buffers:

use yazi::*;
// Your source data.
let data = &(0..=255).cycle().take(8192).collect::<Vec<u8>>()[..];
// Compress it into a Vec<u8> with a zlib wrapper using the default compression level.
let compressed = compress(data, Format::Zlib, CompressionLevel::Default).unwrap();
// Decompress it into a Vec<u8>.
let (decompressed, checksum) = decompress(&compressed, Format::Zlib).unwrap();
// Verify the checksum.
assert_eq!(Adler32::from_buf(&decompressed).finish(), checksum.unwrap());
// Verify that the decompressed data matches the original.
assert_eq!(data, &decompressed[..]);

For detail on more advanced usage, see the full API documentation.

No runtime deps