[Nottingham] Calculating the overhead of "tar"

Mike Cardwell lug at blubbernet.com
Sun Dec 12 14:46:23 GMT 2004


I have an obscure question, and this is the most appropriate list I read
to ask it on. So please bare with me :)

This is in a linux/modperl environment, where a tarball is generated from 
a directory and sent to the web browser as it is being generated, rather 
than writing it to disk, or reading it all into memory first.

The problem is, I can't set a Content-length http header because I don't 
know how big the tarball is going to be in advance. Which means people 
don't get a nice progress bar and/or estimated time to download when 
downloading the "file" over http.

I am confident that there is a method for calculating what the filesize 
of a tarball will be, by simply knowing the filenames, filesizes, and 
directory structure that are going to be in it. I am having real trouble 
finding anything helpful on google or cpan though.

Fortunately, I'm not talking about a gzip compressed tarball here, just a 
normal .tar.

At the moment, I am stuck with giving an estimated filesize in the actual 
html by adding up the sizes of all of the files that are going to be in 
it, which isn't really ideal.

Thanks in advance,

Mike

-- 
Digital photo printing:
http://www.fotoserve.com/?affiliate_id=1093871459



More information about the Nottingham mailing list