CoolFace
Apppublic

TrinetraLabs/Placebo_AI

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
index.js56 linesDownload Raw Back to lib
1"use strict";2 3/**4 * Representation a of zip file in js5 * @constructor6 */7function JSZip() {8    // if this constructor is used without `new`, it adds `new` before itself:9    if(!(this instanceof JSZip)) {10        return new JSZip();11    }12 13    if(arguments.length) {14        throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");15    }16 17    // object containing the files :18    // {19    //   "folder/" : {...},20    //   "folder/data.txt" : {...}21    // }22    // NOTE: we use a null prototype because we do not23    // want filenames like "toString" coming from a zip file24    // to overwrite methods and attributes in a normal Object.25    this.files = Object.create(null);26 27    this.comment = null;28 29    // Where we are in the hierarchy30    this.root = "";31    this.clone = function() {32        var newObj = new JSZip();33        for (var i in this) {34            if (typeof this[i] !== "function") {35                newObj[i] = this[i];36            }37        }38        return newObj;39    };40}41JSZip.prototype = require("./object");42JSZip.prototype.loadAsync = require("./load");43JSZip.support = require("./support");44JSZip.defaults = require("./defaults");45 46// TODO find a better way to handle this version,47// a require('package.json').version doesn't work with webpack, see #32748JSZip.version = "3.10.1";49 50JSZip.loadAsync = function (content, options) {51    return new JSZip().loadAsync(content, options);52};53 54JSZip.external = require("./external");55module.exports = JSZip;56