7 releases

0.3.0 Jan 4, 2023
0.2.0 May 2, 2021
0.1.4 May 2, 2021
0.1.3 May 5, 2020
0.1.0 Jan 7, 2018

#72 in Compression

Download history 166914/week @ 2024-08-16 158270/week @ 2024-08-23 151941/week @ 2024-08-30 179078/week @ 2024-09-06 162686/week @ 2024-09-13 196604/week @ 2024-09-20 175483/week @ 2024-09-27 218185/week @ 2024-10-04 201569/week @ 2024-10-11 223512/week @ 2024-10-18 247498/week @ 2024-10-25 218867/week @ 2024-11-01 234830/week @ 2024-11-08 210268/week @ 2024-11-15 168233/week @ 2024-11-22 125285/week @ 2024-11-29

789,396 downloads per month
Used in 87 crates (41 directly)

MIT license

125KB
3K SLoC

lzma-rs

Crate Documentation Safety Dance Build Status Minimum rust 1.50 Codecov

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.

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