I want the uncompressed size of a gzipped file using rust crate flate2
.
How do I ask a GzDecoder
or MultiGzDecoder
for the uncompressed file size without reading the entire file?
I'm hoping for a simple function call like header.filesz()
:
use std::io::prelude::*;
use std::fs::File;
extern crate flate2;
use flate2::read::GzDecoder;
fn main() -> {
let file1 = File::open("file1.gz").unwrap();
let mut decoder = GzDecoder::new(file1);
let header = decoder.header().unwrap();
let filesz = header.filesz();
}