6

I have a large .gz file (roughly about 100Mb in size), however, when I process the file using the following code, the outputted file is only 256k.

var fs = require('fs'), zlib = require('zlib');

var inp1 = fs.createReadStream('feed.xml.gz');
var out1 = fs.createWriteStream('feed.xml');

inp1.pipe(zlib.createGunzip()).pipe(out1);

The problem seems to be with the zlib.createGunzip() pipe.

Is there a way to fix this? I'm trying to stream direct from the internet preferably.

Paul
  • 756
  • 1
  • 10
  • 22
  • I assume it extracts properly when running `gzip feed.xml.gz` in a terminal? – loganfsmyth Apr 23 '14 at 04:11
  • gunzip feed.xml.gz works perfectly from the command line, but I'm preferably looking for the streaming solution to do it on the fly. It's not the file that is the issue, the output file is 256k, which I assume is the size of the buffer the file is being put into. – Paul Apr 23 '14 at 08:08
  • Any luck figuring this one out? – David Gatti Dec 27 '16 at 12:01
  • The answer for this question can be found hear http://stackoverflow.com/questions/29466797/node-zlib-creating-invalid-gz-files-when-streaming – David Gatti Dec 27 '16 at 12:18

0 Answers0