#lzma #compression #decompression

yanked lzma-rs-headerless

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

1 unstable release

0.5.3 Aug 3, 2022
0.5.2 Aug 2, 2022
0.4.1-api-alpha May 30, 2022
0.2.2 May 17, 2022

#3 in #lzma

Download history 23/week @ 2022-05-05 47/week @ 2022-05-12 25/week @ 2022-05-19 57/week @ 2022-05-26 58/week @ 2022-06-02 32/week @ 2022-06-09 32/week @ 2022-06-16 40/week @ 2022-06-23 16/week @ 2022-06-30 14/week @ 2022-07-07 6/week @ 2022-07-14 17/week @ 2022-07-21 89/week @ 2022-07-28 61/week @ 2022-08-04

178 downloads per month

MIT license

120KB
3K SLoC

lzma-rs

Crate Documentation Safety Dance Build Status Minimum rust 1.50

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

~110–435KB