dyz1990 / sevenz-rust

A 7z decompressor/compressor lib written in pure rust
Apache License 2.0
146 stars 24 forks source link

Decompression failure #28

Closed 1739616529 closed 11 months ago

1739616529 commented 12 months ago

system: windows 10 x64 ltsc 21H2 19044.3208 rust-version:

PS E:\.self\learn-rust> rustc -V
rustc 1.71.0 (8ede3aae2 2023-07-12)

code:

use std::fs;
use sevenz_rust;

fn main() {
    fs::remove_dir_all("node").unwrap();
    sevenz_rust::decompress_file("node.7z", "node").expect("complete1111");
}

log:


PS E:\.self\learn-rust> cargo run
   Compiling learn-rust v0.1.0 (E:\.self\learn-rust)
    Finished dev [unoptimized + debuginfo] target(s) in 0.40s
     Running `target\debug\learn-rust.exe`
thread 'main' panicked at 'complete: Other("Multi input/output stream coders are not yet supported")', src\main.rs:5:53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\learn-rust.exe` (exit code: 101)
PS E:\.self\learn-rust>
dyz1990 commented 11 months ago

As the error message said, multi input/output stream coders are not yet supported. There are certain features in 7z this lib doesn't support,and "multi stream coders" is one of them. I'll leave this issue open as an enhancement request

bonigarcia commented 11 months ago

+1 for implementing this feature

dyz1990 commented 11 months ago

@bonigarcia @1739616529
The latest commit of the main branch added support for bcj2, which contains multiple input streams. You can try to unzip the file that failed before

bonigarcia commented 11 months ago

Yes, it works! Excellent job, @dyz1990!

The performance is not the best, but I managed to uncompress the 7z file I'm working on. For the record, that file was 55.7 MB, and the time required to uncompress it (using cargo) was 2 minutes and 13 seconds (in an AMD Ryzen 7 with 8 cores and 16 GB RAM).

dyz1990 commented 11 months ago

For the record, that file was 55.7 MB, and the time required to uncompress it (using cargo) was 2 minutes and 13 seconds (in an AMD Ryzen 7 with 8 cores and 16 GB RAM).

That's toooo slow. Did you run you code in release mode?

bonigarcia commented 11 months ago

I have much better results when using sevenz_rust::decompress and a reader (around 30 seconds for a 55MB 7z file) instead of sevenz_rust::decompress_file. I think that's ok.

Can you please release a new crate version with this feature? Thank you!

dyz1990 commented 11 months ago

@bonigarcia OK