#decompression #lzma #file-format

lzma-rs-perf-exp

A codec for LZMA, LZMA2 and XZ written in pure Rust with performance experiments

1 unstable release

0.2.1 Aug 9, 2022

#658 in Compression

Download history 3/week @ 2024-07-19 17/week @ 2024-07-26 14/week @ 2024-08-02 35/week @ 2024-08-09 14/week @ 2024-08-16 8/week @ 2024-08-23 10/week @ 2024-08-30 61/week @ 2024-09-06 30/week @ 2024-09-13 31/week @ 2024-09-20 65/week @ 2024-09-27 26/week @ 2024-10-04 46/week @ 2024-10-11 45/week @ 2024-10-18 30/week @ 2024-10-25 19/week @ 2024-11-01

141 downloads per month
Used in 2 crates (via chd)

MIT license

130KB
3K SLoC

lzma-rs-perf-exp

Crate Documentation Safety Dance Build Status Minimum rust 1.51

This project is a decoder for LZMA and its variants written in pure Rust, with focus on clarity. It already supports LZMA, LZMA2 and a subset of the .xz file format.

This fork provides some (API-unstable) performance experiments for use in chd-rs, which may gradually be upstreamed. The API is subject to change without a corresponding SemVer-compatible version bump.

Usage

Decompress a .xz file.

let filename = "foo.xz";
let mut f = std::io::BufReader::new(std::fs::File::open(filename).unwrap());
// "decomp" can be anything that implements "std::io::Write"
let mut decomp: Vec<u8> = Vec::new();
lzma_rs::xz_decompress(&mut f, &mut decomp).unwrap();
// Decompressed content is now in "decomp"

Encoder

For now, there is also a dumb encoder that only uses byte literals, with many hard-coded constants for code simplicity. Better encoders are welcome!

Contributing

Pull-requests are welcome, to improve the decoder, add better encoders, or more tests. Ultimately, this project should also implement .xz and .7z files.

License

MIT

Dependencies

~0.2–7.5MB
~50K SLoC