title: javascript - zip a Blob with zip.js
body: <p>I need to store a lot of text in WebSQl, so I decided to compress the text with <a href="http://gildas-lormeau.github.io/zip.js/" rel="nofollow noreferrer">zip.js</a>
  and store the compressed Blobs.</p>
  <p>From the documentation you can compress a blob as follows:</p>
  <pre><code>function zipBlob(filename, blob, callback) {
     // use a zip.BlobWriter object to write zipped data into a Blob object
     zip.createWriter(new zip.BlobWriter(&quot;application/zip&quot;), function(zipWriter) {
        // use a BlobReader object to read the data stored into blob variable
        zipWriter.add(filename, new zip.BlobReader(blob), function() {
           // close the writer and calls callback function
           zipWriter.close(callback);
        });
     }, onerror);
  }
  </code></pre>
  <p>Although this works, I don't understand why you need to specify a filename. Is this really necessary? And, is this file always removed after compression?</p>