How to use the jszip.make 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 Mostafa-Samir / zip-local / main.js View on Github external
ZipLocal.sync.zip = function(entity, buffer_name) {

    var zipped_obj = JSZip.make();

    if (typeof entity === "string") {

        // the entity is a path pointing to a file or a directory

        var normalized_path = path.normalize(entity);
        var stats = fs.statSync(normalized_path);

        if (stats.isDirectory()) {

            // start zipping the directory
            zip_dir_sync(normalized_path, zipped_obj);

            return new ZipExport(zipped_obj);
        }
        else {
github Mostafa-Samir / zip-local / main.js View on Github external
ZipLocal.sync.unzip = function (file) {

    var zipped_obj = JSZip.make();

    if (typeof file === "string") {

        // file is a path that points to a zip file

        var normalized_path = path.normalize(file);

        var data = fs.readFileSync(normalized_path);

        zipped_obj.load(data);
    }
    else if (file instanceof Buffer) {

        // file is a Buffer that contains the data

        zipped_obj.load(file);
github Mostafa-Samir / zip-local / main.js View on Github external
ZipLocal.zip = function (entity, _callback, _shiftedCallback) {

    var zipped_obj = JSZip.make();

    if (typeof entity === "string") {

        // the entity is a path pointing to a file or a directory

        // the callback is not shifted
        var callback = _callback || function () { };

        var normalized_path = path.normalize(entity);

        fs.stat(normalized_path, function (err, stats) {

            if (err) {
                callback(err);
                return;
            }

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