title: Import zipped file from http request, extract csv files and save as javascript array of objects
body: <p>I wonder to get zipped data from an URL
  (<a href="https://developers.google.com/transit/gtfs/examples/sample-feed.zip" rel="nofollow noreferrer">https://developers.google.com/transit/gtfs/examples/sample-feed.zip</a>) and convert each csv file to an Javascript Array of Objects binding.</p>
  <p>For example, from routes.txt, I want to get:</p>
  <pre><code>    routes = [
      {
      route_id: 'AB'
      agency_id: 'DTA'
      route_short_name: '10'
      route_long_name: 'Airport - Bullfrog'
      route_desc: null
      route_type: 3
      route_url: null
      route_color: null
      route_text_color: null
      },
      {
      route_id: 'BFC'
      agency_id: 'DTA'
      route_short_name: '20'
      route_long_name: 'Bullfrog - Furnace Creek Resort'
      route_desc: null
      route_type: 3
      route_url: null
      route_color: null
      route_text_color: null
      }
  ...
      ]
  </code></pre>
  <p>All operations should be done directly in browser.</p>
  <p>First, I tried to use Zip.js, but I think I don't know how to control promise use</p>
  <pre><code>let GTFS_URL = `http://sjc.infobus.engdb.com.br/infoponto/google_transit.zip`
          const GTFS_ZIP = new zip.ZipReader(new zip.HttpReader(GTFS_URL))
  
          const entries = await GTFS_ZIP.getEntries()
          console.log(entries)
  
          if (entries.length) {
  
  // get first entry content as text by using a TextWriter
  const text = await entries[0].getData(
          // writer
          new zip.TextWriter(),
          // options
          {
          onprogress: (index, max) =&gt; {
          // onprogress callback
          }
          }
  );
          // text contains the entry data as a String
          console.log(text);
  }
  
  // close the ZipReader
      await reader.close();
      }
      )
  </code></pre>
  <p><em>Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules</em></p>
  <p>Then, I tried JSzip solution</p>
  <pre><code>let GTFS_URL = `https://developers.google.com/transit/gtfs/examples/sample-feed.zip`
  
  var zip = new JSZip();
  zip.loadAsync(GTFS_URL)
          .then(function (GTFS_URL) {
              console.log(GTFS_URL)
              alert(&quot;OK&quot;)
          }, function () {
              alert(&quot;Not a valid zip file&quot;)
          });
  </code></pre>
  <p>I saw a lot of similar questions here in stackoverflow, but I couldn't get any of these to work the way I need</p>