title: Unable to unzip file in node.js using zlib module
body: <p>I have created a zip file of a .txt file using node.js zlib and while trying to unzip the file i used the same node_module zlib but its throwing error.Please check my code snippet and please feel free to edit code.I also checked the file location its same as the </p>
  
  <p><strong>Error :</strong></p>
  
  <blockquote>
    <p>Error: unexpected end of file
        at Unzip.zlibOnError (zlib.js:153:15)</p>
  </blockquote>
  
  <p><strong>Code :</strong></p>
  
  <pre><code>    const fs=require('fs');
      const zlib = require('zlib');  
      const iii = fs.createReadStream('test.txt.gz');
      const oo = fs.createWriteStream('test1.txt');  
      const unzip = zlib.createUnzip()  
      iii.pipe(unzip).pipe(oo)
  </code></pre>
  
  <p>I am unable to understand my mistake.Can anyone help me with the same?</p>
  
  <p>Thanks in advance!!</p>
  
  <p>Used below code to zip the file.</p>
  
  <p><strong>code to zip:</strong></p>
  
  <pre><code>const fs=require('fs');
  const zlib = require('zlib');  
  const gzip = zlib.createGzip();  
  
  const inp = fs.createReadStream('test.txt');  
  const out = fs.createWriteStream('test.txt.gz');  
  inp.pipe(gzip).pipe(out);  
  </code></pre>