title: Node Zlib creating invalid .gz files when streaming
body: <p>I am trying to create a .gz file by streaming strings (JSONs separated by newlines) to it gradually.</p>
  
  <p>Using Node 0.11 and 0.12 (both with same reasult, .gz  file won't open).</p>
  
  <p>I reduced the code to this:</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>The file is created, but I cannot open it. What  am I doing wrong?</p>