Processing a gzipped csv-file by line-by-line

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 12 06:11:57 PDT 2017


On 5/10/17 7:17 PM, Nicholas Wilson wrote:
> On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote:
>> What's fastest way to on-the-fly-decompress and process a gzipped
>> csv-fil line by line?
>>
>> Is it possible to combine
>>
>> http://dlang.org/phobos/std_zlib.html
>>
>> with some stream variant of
>>
>> File(path).byLineFast
>>
>> ?
>
> I suggest you take a look at Steven's iopipe (also watch his Dconf
> presentation). should be very simple.

Yeah, this should work and be quite fast:

import iopipe.zip;
import iopipe.textpipe;
import iopipe.bufpipe;
import iopipe.stream;

foreach(line; openDev(path).bufd.unzip.decodeText.byLineRange)

I think that was actually one of my slide examples.

-Steve


More information about the Digitalmars-d-learn mailing list