This project is a 7z compressor/decompressor written in pure Rust.
This is a fork of the original, unmaintained sevenz-rust crate to continue the development and maintenance.
Supported Codecs & filters
| Codec | Decompression | Compression |
|---|---|---|
| COPY | ✓ | ✓ |
| LZMA | ✓ | ✓ |
| LZMA2 | ✓ | ✓ |
| BROTLI (*) | ✓ | ✓ |
| BZIP2 (*) | ✓ | ✓ |
| DEFLATE (*) | ✓ | ✓ |
| LZ4 (*) | ✓ | ✓ |
| ZSTD (*) | ✓ | ✓ |
(*) Require optional cargo feature.
| Filter | Decompression | Compression |
|---|---|---|
| BCJ X86 | ✓ | |
| BCJ PPC | ✓ | |
| BCJ IA64 | ✓ | |
| BCJ ARM | ✓ | |
| BCJ ARM_THUMB | ✓ | |
| BCJ SPARC | ✓ | |
| DELTA | ✓ | |
| BCJ2 | ✓ |
Usage
[]
= { = "0.10" }
Decompress source file "data/sample.7z" to destination path "data/sample":
decompress_file.expect;
Decompress an encrypted 7z file
Add the 'aes256' feature:
[]
= { = "0.10", = ["aes256"] }
decompress_file_with_password.expect;
Compression
Add the 'compress' feature:
[]
= { = "0.10", = ["compress"] }
Use the helper function to create a 7z file with source path:
compress_to_path.expect;
Compress with AES encryption
Add the 'compress' and 'aes256' feature:
[]
= { = "0.10", = ["compress", "aes256"] }
Use the helper function to create a 7z file with source path and password:
compress_to_path_encrypted.expect;
Advanced Usage
Solid compression
Solid archives can in theory provide better compression rates, but decompressing a file needs all previous data to also be decompressed.
use *;
let mut sz = create.expect;
sz.push_source_path.expect;
sz.finish.expect;
Configure the compression methods
With encryption and lzma2 options:
use *;
let mut sz = create.expect;
sz.set_content_methods;
sz.push_source_path.expect;
sz.finish.expect;
Licence
Licensed under the Apache License, Version 2.0.