rust-lang / flate2-rs

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

Testing validity of the data without the actual decompression #390

Closed nyurik closed 6 months ago

nyurik commented 6 months ago

My sqlite-compression extension needs to support gzip testing in addition to compression/decompression. Currently I do it with decode(data).is_ok(), but that causes a lot of unnecessary memory allocation and possibly other steps. Is there a way to efficiently validate the content of the gzip stream without allocating/re-allocating output buffers?