Closed Smotrov closed 4 years ago
Hi @Smotrov, thank you for reaching out.
In terms of API, you can specify a Lz77Encode
instance to control the compression level via the EncodeOptions::with_lz77
method as follows:
// From: https://docs.rs/libflate/1.0.2/libflate/deflate/struct.EncodeOptions.html#example
use libflate::lz77::DefaultLz77Encoder;
use libflate::deflate::{Encoder, EncodeOptions};
let options = EncodeOptions::with_lz77(DefaultLz77Encoder::new());
let encoder = Encoder::with_options(Vec::new(), options);
However, unfortunately, the current libflate
only provides DefaultLz77Encoder
as a practical built-in LZ77 encoder implementation and it doesn't have the capability to change the compression level.
(Actually, there is another Lz77Encode
implementation named NoCompressionLz77Encoder
but it seems to be of little use in practice)
Thank you very much @sile! Same story from GZIP?
Same story from GZIP?
Yes (cf. libflate::gzip::EncodeOptions).
🙏
Hi @Smotrov, thank you for reaching out.
In terms of API, you can specify a
Lz77Encode
instance to control the compression level via theEncodeOptions::with_lz77
method as follows:// From: https://docs.rs/libflate/1.0.2/libflate/deflate/struct.EncodeOptions.html#example use libflate::lz77::DefaultLz77Encoder; use libflate::deflate::{Encoder, EncodeOptions}; let options = EncodeOptions::with_lz77(DefaultLz77Encoder::new()); let encoder = Encoder::with_options(Vec::new(), options);
However, unfortunately, the current
libflate
only providesDefaultLz77Encoder
as a practical built-in LZ77 encoder implementation and it doesn't have the capability to change the compression level. (Actually, there is anotherLz77Encode
implementation namedNoCompressionLz77Encoder
but it seems to be of little use in practice)
I fail to see why this story was closed. The issue is no resolved. Even with:
let options = EncodeOptions::with_lz77(DefaultLz77Encoder::new());
there is no way to set the compression level. You also cannot push it through header, the field is private.
Hi all! Would appreciate it if someone will point me to an example showing how to set a certain compression level when I compress some data using libflate. Thank you in advance!