lundi 6 avril 2015

Node Zlib creating invalid .gz files when streaming

I am trying to create a .gz file by streaming strings (JSONs separated by newlines) to it gradually.


Using Node 0.11 and 0.12 (both with same reasult, .gz file won't open).


I reduced the code to this:



var fs = require('fs');
var output = fs.createWriteStream('test.gz');
var zlib = require('zlib');
var compress = zlib.createGzip();
var myStream = compress.pipe(output);

myStream.write('Hello, World!');
myStream.end();


The file is created, but I cannot open it. What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire