#deflate #zlib #decompression

no-std yazi

DEFLATE/zlib compression and decompression

6 releases

0.2.0 Nov 29, 2023
0.1.6 May 6, 2023
0.1.5 Apr 9, 2023
0.1.4 Jun 25, 2021
0.1.1 Mar 24, 2020

#45 in Compression

Download history 5815/week @ 2023-11-10 5027/week @ 2023-11-17 5796/week @ 2023-11-24 4952/week @ 2023-12-01 5601/week @ 2023-12-08 5941/week @ 2023-12-15 4680/week @ 2023-12-22 5145/week @ 2023-12-29 6427/week @ 2024-01-05 9243/week @ 2024-01-12 8972/week @ 2024-01-19 8745/week @ 2024-01-26 8530/week @ 2024-02-02 10113/week @ 2024-02-09 10887/week @ 2024-02-16 8945/week @ 2024-02-23

39,875 downloads per month
Used in 12 crates (5 directly)

MIT/Apache

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

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