title: How to generate text files and download a zip file in Javascript?
body: <p>I would like to know the best way in Javascript (maybe in JQuery) to do the following things without server coding if able :</p>
  
  <ol>
  <li><strong>Generate around 20 text files from sets of objects.</strong></li>
  <li><strong>Zip these files into a ZIP file.</strong></li>
  <li><strong>Download this ZIP file.</strong></li>
  </ol>
  
  <hr>
  
  <h2>1. Generate around 20 text files from sets of objects</h2>
  
  <p>There are around 20 sets of objects, with around 90 objects in each set of objects. Here is an example of the sets of objects :</p>
  
  <pre><code>var cardsPlayer1 = {
    name : "Player 1",
    [
      {nbCopies : 3, name : "Noise"},
      {nbCopies : 1, name : "Parasite"},
      {nbCopies : 2, name : "Sure Gamble"},
      ... (around 90 of these objects)
    ]
  };
  
  var cardsPlayer2 = 
    name : "Player 2",
    [
      {nbCopies : 1, name : "Gabriel Santiago"},
      {nbCopies : 3, name : "Pipeline"},
      {nbCopies : 2, name : "Aurora"},
      ... (around 90 of these objects)
    ]
  };
  
  ... (until cardsPlayer20)
  </code></pre>
  
  <p>The generated text files should be :</p>
  
  <p><em>player1.txt</em></p>
  
  <pre><code>3 Noise
  1 Parasite
  2 Sure Gamble
  ...
  </code></pre>
  
  <p><em>player2.txt</em></p>
  
  <pre><code>1 Gabriel Santiago
  2 Pipeline
  2 Aurora
  ...
  </code></pre>
  
  <p>...(until <em>player20.txt</em>)</p>
  
  <h2>2. Zip these files into a ZIP file</h2>
  
  <p>I would like to ZIP player1.txt until player20.txt into a ZIP file players.zip.</p>
  
  <h2>3. Download this ZIP file</h2>
  
  <p>I would like to download the ZIP file players.zip.</p>
  
  <p>Thank you for your help and your answers.</p>