GZip File Reading

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Mar 10 02:57:47 PST 2011


On Thu, 10 Mar 2011 10:17:17 +0000, Russel Winder wrote:

> On Wed, 2011-03-09 at 23:53 -0500, dsimcha wrote:
>> I noticed last night that Phobos actually has all the machinations
>> required for reading gzipped files, buried in etc.c.zlib.  I've wanted
>> a high-level D interface for reading and writing compressed files with
>> an API similar to "normal" file I/O for a while.  I'm thinking about
>> what the easiest/best design would be.  At a high level there are two
>> designs:
> 
> But isn't a gzip (or zip, 7z, bzip2, etc., etc.) file actually a
> container:  a tree of files.  So isn't it more a persistent data
> structure that has a rendering as a single flat file on the filestore,
> than being a partitioned flat file which is what you will end up with if
> you head directly down the file/stream route?

Nope, a gzip or bzip2 file only contains a single file.  To zip several 
files, you first make a tar archive, and then you run gzip or bzip2 on 
it.  That's why most compressed archives targeted at the Linux platform 
have extensions like .tar.gz, .tar.bz2, and so on.

-Lars


More information about the Digitalmars-d mailing list