rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust
https://docs.rs/flate2
Apache License 2.0
891 stars 158 forks source link

why not export API to access intermedia result for each compression? #289

Closed kingluo closed 2 years ago

kingluo commented 2 years ago

Given that I need to compress a huge file for HTTP download, then I need to compress each chunk of the file and send chunk by chunk via HTTP response. But this crate does not export API to access intermedia compression results, it just collects the output of each chunk and only finish() returns the final result. But how about OOM? In fact, the zlib itself provides the interface to access the intermedia result.

alexcrichton commented 2 years ago

All interfaces in this crate should work for your purposes. If you want really low-level support there's the Compress type as well.

kingluo commented 2 years ago

How to use gzip and deflate respectively via Compress?

alexcrichton commented 2 years ago

Internally Compress is used by all the I/O types.