Read and write gzip files easily.

via Digitalmars-d digitalmars-d at puremagic.com
Sun May 3 07:33:45 PDT 2015


On Thursday, 20 February 2014 at 10:35:50 UTC, Stephan Schiffels 
wrote:
> Hi Kamil,
> I am glad someone has the exact same problem as I had. I 
> actually solved this, inspired by the python API you quoted 
> above. I wrote these classes:
> GzipInputRange, GzipByLine, and GzipOut.
> Here is how I can now use them:
>

I've polished your module a bit at:

https://github.com/nordlow/justd/blob/611ae3aac35a085af966e0c3b717deb0012f637b/zio.d

Reflections:

- Performance is terrible even with -release -noboundscheck 
-unittest. About 20 times slower than zcat $F | wc -l. I'm 
guessing

     _chunkRange.front.dup

slows things down. I tried removing the .dup but then I get

     std.zlib.ZlibException at std/zlib.d(59): data error

I don't believe we should have to do a copy of _chunkRange.front 
but I can't figure out how to solve it. Anybody understands how 
to fix this?

- Shouldn't GzipOut.finish() call this.close()? Otherwise the 
file remains unflushed.
- And what about calling this.close() in GzipOut.~this()? Is that 
needed to?


More information about the Digitalmars-d mailing list