How to use the jszip.external 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 dtjohnson / xlsx-populate / test / unit / XlsxPopulate.spec.js View on Github external
"use strict";

const proxyquire = require("proxyquire");
const Promise = require("jszip").external.Promise;

describe("XlsxPopulate", () => {
    let dateConverter, Workbook, XlsxPopulate, FormulaError, externals;

    beforeEach(() => {
        dateConverter = jasmine.createSpyObj("dateConverter", ["dateToNumber", "numberToDate"]);
        dateConverter.dateToNumber.and.returnValue("NUMBER");
        dateConverter.numberToDate.and.returnValue("DATE");

        Workbook = jasmine.createSpyObj("Workbook", ["fromBlankAsync", "fromDataAsync", "fromFileAsync"]);
        Workbook.fromBlankAsync.and.returnValue("WORKBOOK");
        Workbook.fromDataAsync.and.returnValue("WORKBOOK");
        Workbook.fromFileAsync.and.returnValue("WORKBOOK");
        Workbook.MIME_TYPE = "MIME_TYPE";

        // proxyquire doesn't like overriding raw objects... a spy obj works.
github duddu / cordova-plugin-antitampering / tests / tamper / android.js View on Github external
'use strict';

/* eslint no-console: 0, no-process-env: 0 */

var fs = require('fs');
var path = require('path');
var JSZip = require('jszip');

var apk;
var indexAsset = 'assets/www/index.html';
var platformPath = path.join(process.env.ANTITAMPERING_TEST_DIR, 'platforms/android');
var tamperedApkPath = path.join(process.env.TRAVIS_BUILD_DIR, 'tests/android-tampered.apk');

new JSZip.external.Promise(function (resolve, reject) {
    fs.readFile(path.join(platformPath, 'app/build/outputs/apk/debug/app-debug.apk'), function (_err, _data) {
        if (!_err) {
            resolve(_data);
        } else {
            fs.readFile(path.join(platformPath, 'build/outputs/apk/android-debug.apk'), function (err, data) {
                if (!err) {
                    resolve(data);
                } else {
                    reject(err);
                }
            });
        }
    });
})
    .then(function (data) {
        return JSZip.loadAsync(data);
github dtjohnson / xlsx-populate / test / unit / XmlParser.spec.js View on Github external
"use strict";

const proxyquire = require("proxyquire");
const Promise = require("jszip").external.Promise;

describe("XmlParser", () => {
    let XmlParser, xmlParser, externals;

    beforeEach(() => {
        // proxyquire doesn't like overriding raw objects... a spy obj works.
        externals = jasmine.createSpyObj("externals", ["_"]);
        externals.Promise = Promise;

        XmlParser = proxyquire("../../lib/XmlParser", {
            './externals': externals,
            '@noCallThru': true
        });
        xmlParser = new XmlParser();
    });
github aamks / aamks / gui / interface / src / app / views / main / risk / results / results.component.ts View on Github external
public showAnimation(chosenAnim) {
    // After static data is loaded to paperjs we can run animations.
    // 0.000001 & friends prevent divisions by 0.
    var promise = new JSZip.external.Promise(function (resolve, reject) {
      JSZipUtils.getBinaryContent("../" + chosenAnim["anim"], function (err, data) {
        if (err) {
          reject(err);
        } else {
          resolve(data);
        }
      });
    });

    promise.then(JSZip.loadAsync)
      .then(function (zip) {
        console.log(zip);
        return zip.catch.toString();
        //return zip.file("anim.json").async("string");
      })
github WikiWatershed / model-my-watershed / src / mmw / js / src / draw / views.js View on Github external
modalViews = require('../core/modals/views');

var selectBoundary = 'selectBoundary',
    drawArea = 'drawArea',
    delineateWatershed = 'delineateWatershed',
    aoiUpload = 'aoiUpload',
    freeDraw = 'free-draw',
    squareKm = 'square-km',
    GA_AOI_CATEGORY = 'AoI Creation';

var codeToLayer = {}; // code to layer mapping

// The shapefile library relies on a native Promise implementation,
// a polyfill for which is available in the JSZip library
if (!window.Promise) {
    window.Promise = JSZip.external.Promise;
}

function displayAlert(message, alertType) {
    if (message === drawUtils.CANCEL_DRAWING) {
        return;
    }

    var alertView = new modalViews.AlertView({
        model: new modalModels.AlertModel({
            alertMessage: message,
            alertType: alertType
        })
    });

    alertView.render();
}
github gitlabhq / gitlabhq / app / assets / javascripts / index.js View on Github external
getZipFile() {
    return new JSZip.external.Promise((resolve, reject) => {
      JSZipUtils.getBinaryContent(this.el.dataset.endpoint, (err, data) => {
        if (err) {
          reject(err);
        } else {
          resolve(data);
        }
      });
    });
  }
github gitlabhq / gitlabhq / app / assets / javascripts / index.js View on Github external
getZipFile() {
    return new JSZip.external.Promise((resolve, reject) => {
      JSZipUtils.getBinaryContent(this.el.dataset.endpoint, (err, data) => {
        if (err) {
          reject(err);
        } else {
          resolve(data);
        }
      });
    });
  }
github dtjohnson / xlsx-populate / lib / externals.js View on Github external
get Promise() {
        return JSZip.external.Promise;
    },
github gitlabhq / gitlabhq / app / assets / javascripts / index.js View on Github external
getZipFile() {
    return new JSZip.external.Promise((resolve, reject) => {
      JSZipUtils.getBinaryContent(this.container.dataset.endpoint, (err, data) => {
        if (err) {
          reject(err);
        } else {
          resolve(data);
        }
      });
    });
  }
github martonsagi / al-object-designer / extension-al-object-designer / src / utils.ts View on Github external
return new Promise((res, rej) => {
        new JSZip.external.Promise(function (resolve: any, reject: any) {
            fs.readFile(filePath, function (err: any, data: any) {
                if (err) {
                    reject(err);
                } else {
                    resolve(data);
                }
            });
        }).then(function (data: any) {
            return JSZip.loadAsync(data);
        }).then((d: any) => {
            res(d);
        }).catch((e: any) => rej(e));
    });
}

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

80 / 100
Full package analysis