* Representation a of zip file in js * @constructor * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). * @param {Object=} options the options for creating this objects (optional).
(data, options)
| 12527 | * @param {Object=} options the options for creating this objects (optional). |
| 12528 | */ |
| 12529 | function JSZip(data, options) { |
| 12530 | // if this constructor is used without `new`, it adds `new` before itself: |
| 12531 | if(!(this instanceof JSZip)) return new JSZip(data, options); |
| 12532 | |
| 12533 | // object containing the files : |
| 12534 | // { |
| 12535 | // "folder/" : {...}, |
| 12536 | // "folder/data.txt" : {...} |
| 12537 | // } |
| 12538 | this.files = {}; |
| 12539 | |
| 12540 | this.comment = null; |
| 12541 | |
| 12542 | // Where we are in the hierarchy |
| 12543 | this.root = ""; |
| 12544 | if (data) { |
| 12545 | this.load(data, options); |
| 12546 | } |
| 12547 | this.clone = function() { |
| 12548 | var newObj = new JSZip(); |
| 12549 | for (var i in this) { |
| 12550 | if (typeof this[i] !== "function") { |
| 12551 | newObj[i] = this[i]; |
| 12552 | } |
| 12553 | } |
| 12554 | return newObj; |
| 12555 | }; |
| 12556 | } |
| 12557 | JSZip.prototype = require('./object'); |
| 12558 | JSZip.prototype.load = require('./load'); |
| 12559 | JSZip.support = require('./support'); |
nothing calls this directly
no outgoing calls
no test coverage detected