This project is a 7z compressor/decompressor written in pure rust.
And it's very much inspired by the apache commons-compress project.
The LZMA/LZMA2 decoder and all filters code was ported from tukaani xz for java
Supported codecs:
- BZIP2 (require feature 'bzip2')
- COPY
- LZMA
- LZMA2
- ZSTD (require feature 'zstd')
Supported filters:
- BCJ X86
- BCJ PPC
- BCJ IA64
- BCJ ARM
- BCJ ARM_THUMB
- BCJ SPARC
- DELTA
[dependencies]
sevenz-rust={version="0.2"}
Decompress source file "data/sample.7z" to dest path "data/sample"
sevenz_rust::decompress_file("data/sample.7z", "data/sample").expect("complete");
Decompress a encrypted 7z file
Add 'aes256' feature
[dependencies]
sevenz-rust={version="0.2", features=["aes256"]}
sevenz_rust::decompress_file_with_password("path/to/encrypted.7z", "path/to/output", "password".into()).expect("complete");
Currently only support LZMA2 method.
[dependencies]
sevenz-rust={version="0.2", features=["compress"]}
Use the helper function to create a 7z file with source path.
sevenz_rust::compress_to_path("examples/data/sample", "examples/data/sample.7z").expect("compress ok");
require version>=0.3.0
[dependencies]
sevenz-rust={version="0.3", features=["compress","aes256"]}
Use the helper function to create a 7z file with source path and password.
sevenz_rust::compress_to_path_encrypted("examples/data/sample", "examples/data/sample.7z", "password".into()).expect("compress ok");
[dependencies]
sevenz-rust={version="0.3", features=["compress","aes256"]}
use sevenz_rust::*;
let mut sz = SevenZWriter::create("dest.7z").expect("create writer ok");
sz.push_source_path("path/to/compress", |_| true).expect("pack ok");
sz.finish().expect("compress ok");
with encryption and lzma2 options
use sevenz_rust::*;
let mut sz = SevenZWriter::create("dest.7z").expect("create writer ok");
sz.set_content_methods(vec![
sevenz_rust::AesEncoderOptions::new("sevenz-rust".into()).into(),
lzma::LZMA2Options::with_preset(9).into(),
]);
sz.push_source_path("path/to/compress", |_| true).expect("pack ok");
sz.finish().expect("compress ok");
- Removed unsafe code
- Changed
SevenZWriter.finish
method return inner writer - Added wasm compress function
- Updates bzip dependency to the patch version of 0.4.4(#23)
- Fixed unable to build without default features
- Added Encrypted compression
- Fixed numerical overflow
- Change to use nt-time crate(#20)
- Fix typo(#18)
- make function generics less restrictive (#17)
- Solve warnings (#16)
- run rustfmt on code (#15)
- Added bzip2 support(#14)
- Fixed write bitset bugs
- Fixed bug while read files info
- Added zstd support and use enhanced filetime lib(#11)
- Fixed lzma encoder bugs
- Changed return entry ref when pushing to writer(#10)
- Fixed incorrect handling of 7z time
- Move mod
lzma
to sub cratelzma-rust
- Modify Github Actions to run tests with --all-features
- Added compression supporting
- Added aes256sha256 decode method
- Added wasm support
- Added new tests (for Delta and Copy) and Github Actions CI(#5) by bfrazho
- Chnaged new lzma/lzma2 decoder