title: Node Zlib incorrect header check
body: <p>I am trying to unzip a gzipped file in Node but I am running into the following error. </p>
  
  <p><code>Error: incorrect header check
      at Zlib._handle.onerror (zlib.js:370:17)</code></p>
  
  <p>Here is the code the causes the issue.</p>
  
  <pre><code>'use strict'
  
  const fs = require('fs');
  const request = require('request');
  const zlib = require('zlib');
  const path = require('path');
  
  var req = request('https://wiki.mozilla.org/images/f/ff/Example.json.gz').pipe(fs.createWriteStream('example.json.gz'));
  
  req.on('finish', function() {
      var readstream = fs.createReadStream(path.join(__dirname, 'example.json.gz'));
      var writestream = fs.createWriteStream('example.json');
  
      var inflate = zlib.createInflate();
      readstream.pipe(inflate).pipe(writestream);
  });
  //Note using file system because files will eventually be much larger
  </code></pre>
  
  <p>Am I missing something obvious?  If not, how can I determine what is throwing the error?  </p>