How to use the jszip/lib function in jszip

To help you get started, we’ve selected a few jszip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github romannurik / AndroidAssetStudio / app / studio / zip.js View on Github external
generateAndDownloadZipFile_() {
    let filename = this.zipFilename_ || 'output.zip';
    if (!this.fileSpecs_.length) {
      return;
    }

    this.isGenerating_ = true;
    this.updateUI_();

    let zip = new JSZip();

    this.fileSpecs_.forEach(fileSpec => {
      if (fileSpec.canvas) {
        zip.file(fileSpec.name, fileSpec.canvas.toDataURL().replace(/.*?;base64,/, ''), {base64: true});
      } else {
        zip.file(fileSpec.name, fileSpec.textData);
      }
    });

    zip.generateAsync({type: 'blob'}).then(blob => {
      Util.downloadFile(blob, filename);
      this.isGenerating_ = false;
      this.updateUI_();
    }).catch(error => {
      console.error(error);
      this.isGenerating_ = false;

jszip

Create, read and edit .zip files with JavaScript http://stuartk.com/jszip

(MIT OR GPL-3.0-or-later)
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis