3 var base64 = require('./base64');
8 zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing");
9 zip.folder("images").file("smile.gif", base64Data, {base64: true});
10 zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")});
11 zip.remove("tempfile");
13 base64zip = zip.generate();
18 * Representation a of zip file in js
20 * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional).
21 * @param {Object=} options the options for creating this objects (optional).
23 function JSZip(data, options) {
24 // if this constructor is used without `new`, it adds `new` before itself:
25 if(!(this instanceof JSZip)) return new JSZip(data, options);
27 // object containing the files :
30 // "folder/data.txt" : {...}
36 // Where we are in the hierarchy
39 this.load(data, options);
41 this.clone = function() {
42 var newObj = new JSZip();
44 if (typeof this[i] !== "function") {
51 JSZip.prototype = require('./object');
52 JSZip.prototype.load = require('./load');
53 JSZip.support = require('./support');
54 JSZip.defaults = require('./defaults');
58 * This namespace will be removed in a future version without replacement.
60 JSZip.utils = require('./deprecatedPublicUtils');
65 * This method will be removed in a future version without replacement.
67 encode : function(input) {
68 return base64.encode(input);
72 * This method will be removed in a future version without replacement.
74 decode : function(input) {
75 return base64.decode(input);
78 JSZip.compressions = require('./compressions');
79 module.exports = JSZip;