#deflate #zlib #compression-level #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

#225 in Compression

Download history 19480/week @ 2024-08-05 18754/week @ 2024-08-12 14742/week @ 2024-08-19 15601/week @ 2024-08-26 16399/week @ 2024-09-02 18672/week @ 2024-09-09 19872/week @ 2024-09-16 20929/week @ 2024-09-23 22243/week @ 2024-09-30 21796/week @ 2024-10-07 18578/week @ 2024-10-14 15061/week @ 2024-10-21 17513/week @ 2024-10-28 18068/week @ 2024-11-04 17877/week @ 2024-11-11 16993/week @ 2024-11-18

71,665 downloads per month
Used in 15 crates (8 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