How do i tell in Perl what the size of a file inside a gzip archive is without unpacking the whole file? -


i have bunch of ridiculously big files (multiple gigabytes in size) have high compression ratio (1:200 or better). have process , @ least show kind of progress estimate. reason i'd know size of file inside .gz, can compare pulled out already.

however, since unpacking whole file in advance each time rather prohibitive , waste of time, i'd figure size out without doing that.

i know possible. can open gzip files total commander , viewer plugin show me right size. (i know it's not unpacking because shows me size immediately, wouldn't possible 10gb file inside gzip.)

there header fields contain information.

however looking through docs of various cpan modules couldn't find fits bill. io::uncompress::gunzip lets me @ a header, doesn't contain file size information.

any suggestions?

just there's proper answer this:

sub get_gz_size {     ( $gz_file ) = @_;     @raw = `gzip --list $gz_file`;     $size = ( split " ", $raw[1] )[1];     return $size; } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -