Crates.io | lzma-rs |
lib.rs | lzma-rs |
version | 0.3.0 |
source | src |
created_at | 2018-01-07 21:59:22.160891 |
updated_at | 2023-01-04 00:34:47.136594 |
description | A codec for LZMA, LZMA2 and XZ written in pure Rust |
homepage | |
repository | https://github.com/gendx/lzma-rs |
max_upload_size | |
id | 45882 |
size | 129,283 |
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.
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"
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!
Pull-requests are welcome, to improve the decoder, add better encoders, or more tests. Ultimately, this project should also implement .xz and .7z files.
MIT