| Adriano Ferreira 2006-01-10, 4:02 am |
| On 12/30/05, Xavier Noria <fxn@hashref.com> wrote:
> Even if gzipped files have always more than 0 bytes, wouldn't it be
> true than all empty gzipped files have the same size, and that non-
> empty gzipped files are greater than that minimum? In this Mac that
> size seems to be 24 bytes.
Nope. Gzipped files have a header which may include filename.
$ touch foo
$ ls -l foo
-rw-r--r-- 1 me mine 0 Dec 30 2005 foo
$ gzip foo
$ ls -l foo.gz
-rw-r--r-- 1 me mine 24 Dec 30 18:04 foo.gz
$ touch foobar
$ ls -l foobar
-rw-r--r-- 1 me mine 0 Dec 30 2005 foobar
$ gzip foobar
$ ls -l foobar.gz
-rw-r--r-- 1 me mine 27 Dec 30 18:04 foobar.gz
Well - it looks like an empty gzipped file with a name takes C<21 +
length($name)> but that's not reliable since the header size may vary.
$ touch foo
$ ls -l foo
-rw-r--r-- 1 me mine 0 Dec 30 2005 foo
$ gzip -n foo # omit name from header
$ ls -l foo.gz
-rw-r--r-- 1 me mine 20 Dec 30 2005 foo.gz
To be true, in gzip file specifications, there is a field with the
size of the uncompressed data - but that's what
zlib/zcat/Compress::Zlib access for us to know the file is empty.
|