dyz1990 / sevenz-rust

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

No effect on compression level: LZMA2Options::with_preset() #56

Open VictorieeMan opened 5 months ago

VictorieeMan commented 5 months ago

Hi, I was running the following example:

let outputArchive = format!("{}.aes.7z",inputFolder);
let mut sz: SevenZWriter<File> = SevenZWriter::create(outputArchive2).expect("create writer ok");
sz.set_content_methods(vec![
    sevenz_rust::AesEncoderOptions::new("sevenz-rust".into()).into(),
    lzma::LZMA2Options::with_preset(0).into(),
]);
sz.push_source_path(inputFolder, |_| true).expect("pack ok");

sz.finish().expect("compress ok");

and tested around over some different values in with_preset(). My assumption was that 0 would be no compression and 9 would be maximum compression. But no matter the setting, I got the same amount of compression for every entered number. No matter what setting, the compressed folder ends up being 23% of the original. My expectation was that with_preset(0) would not preform any compression at all in this case, but rather just bundle the files together.

Am I misunderstanding something about the implementation on this?