rust-lang / flate2-rs

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

Add method to get current position for GzDecoder #328

Open alexnivanov opened 1 year ago

alexnivanov commented 1 year ago

Greetings!

It would be very nice to have a method to get the current position in compressed file: this way it's possible to calculate/display progress of file processing since we know the size of compressed file, not the uncompressed.

This is what gzoffset does in zlib C library.

hut8 commented 12 months ago

Wouldn't you also know the size of the uncompressed file if you added a "footer" function? That should have the CRC as well as the uncompressed size.

Edit: looks like that's only going to be the size modulo 2^32 ☹️