Skip to content

gendx/lzma-rs

Folders and files

NameName
Last commit message
Last commit date
May 6, 2024
Oct 5, 2020
Mar 16, 2023
May 6, 2024
Mar 16, 2023
Oct 4, 2017
Jan 4, 2023
May 6, 2024
Jan 7, 2018
May 6, 2024
Mar 16, 2023

Repository files navigation

lzma-rs

Crate Documentation Minimum Rust 1.71 Dependencies Safety Dance Build Status Codecov Lines of Code Downloads (crates.io)

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