title: How to generate zip file using Buffer contents in node.js using JSZip?
body: <p>I have an array of strings which should be written to a .txt file. Also I need to compress the resulting .txt file to .zip format using JSZip. At the client side, I was able to generate a 'text/plain' Blob using this array of strings and then I compressed this Blob to .zip format using JSZip. I need to do the same on the server side using node.js, but I realized that Blob is not available in node.js. I tried using 'Buffer' instead of Blob, and I got a binary file compressed as .zip; I am a beginner with node.js and couldn't understand the concepts of Buffer. Can I create a Blob in node.js? or Can I perform the same operations with node.js Buffer?</p>
  
  <p>At the client side I can generate the zip file from Blob contents like this,</p>
  
  <pre><code>//stringsArray is an array of strings
  var blob = new Blob( stringsArray, { type: "text/plain" } );
  
  var zip = new JSZip();
  zip.file( 'file.txt' , blob );
  
  zip.generateAsync( { type: 'blob', compression: 'DEFLATE' } )
  .then( function( zipFile ){ 
  
      //do something with zipFile 
  
  }, function( error ){ 
  
      console.log( 'Error in compression' );
  
  } );
  </code></pre>
  
  <p>How can I do the same using Node.js?</p>