jszip
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -7,2 +7,6 @@ --- | ||
### v3.1.4 2017-08-24 | ||
- consistently use our own utils object for inheritance (see [#395](https://github.com/Stuk/jszip/pull/395)). | ||
- lower the memory consumption in `generate*` with a lot of files (see [#449](https://github.com/Stuk/jszip/pull/449)). | ||
### v3.1.3 2016-10-06 | ||
@@ -9,0 +13,0 @@ - instanceof failing in window / iframe contexts (see [#350](https://github.com/Stuk/jszip/pull/350)). |
@@ -78,2 +78,1 @@ 'use strict'; | ||
}; | ||
// vim: set shiftwidth=4 softtabstop=4: |
@@ -21,17 +21,8 @@ 'use strict'; | ||
this._pako = new pako[action]({ | ||
raw:true, | ||
level : options.level || -1 // default compression | ||
}); | ||
this._pako = null; | ||
this._pakoAction = action; | ||
this._pakoOptions = options; | ||
// the `meta` object from the last chunk received | ||
// this allow this worker to pass around metadata | ||
this.meta = {}; | ||
var self = this; | ||
this._pako.onData = function(data) { | ||
self.push({ | ||
data : data, | ||
meta : self.meta | ||
}); | ||
}; | ||
} | ||
@@ -46,2 +37,5 @@ | ||
this.meta = chunk.meta; | ||
if (this._pako === null) { | ||
this._createPako(); | ||
} | ||
this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); | ||
@@ -55,2 +49,5 @@ }; | ||
GenericWorker.prototype.flush.call(this); | ||
if (this._pako === null) { | ||
this._createPako(); | ||
} | ||
this._pako.push([], true); | ||
@@ -66,2 +63,22 @@ }; | ||
/** | ||
* Create the _pako object. | ||
* TODO: lazy-loading this object isn't the best solution but it's the | ||
* quickest. The best solution is to lazy-load the worker list. See also the | ||
* issue #446. | ||
*/ | ||
FlateWorker.prototype._createPako = function () { | ||
this._pako = new pako[this._pakoAction]({ | ||
raw: true, | ||
level: this._pakoOptions.level || -1 // default compression | ||
}); | ||
var self = this; | ||
this._pako.onData = function(data) { | ||
self.push({ | ||
data : data, | ||
meta : self.meta | ||
}); | ||
}; | ||
}; | ||
exports.compressWorker = function (compressionOptions) { | ||
@@ -68,0 +85,0 @@ return new FlateWorker("Deflate", compressionOptions); |
@@ -45,3 +45,3 @@ 'use strict'; | ||
// a require('package.json').version doesn't work with webpack, see #327 | ||
JSZip.version = "3.1.3"; | ||
JSZip.version = "3.1.4"; | ||
@@ -48,0 +48,0 @@ JSZip.loadAsync = function (content, options) { |
@@ -5,4 +5,4 @@ 'use strict'; | ||
var util = require('util'); | ||
util.inherits(NodejsStreamOutputAdapter, Readable); | ||
var utils = require('../utils'); | ||
utils.inherits(NodejsStreamOutputAdapter, Readable); | ||
@@ -9,0 +9,0 @@ /** |
@@ -29,3 +29,1 @@ 'use strict'; | ||
}; | ||
// vim: set shiftwidth=4 softtabstop=4: |
@@ -28,3 +28,3 @@ 'use strict'; | ||
var signature = this.reader.readString(4); | ||
throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); | ||
throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); | ||
} | ||
@@ -170,5 +170,5 @@ }, | ||
throw new Error("Can't find end of central directory : is this a zip file ? " + | ||
"If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"); | ||
"If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); | ||
} else { | ||
throw new Error("Corrupted zip : can't find end of central directory"); | ||
throw new Error("Corrupted zip: can't find end of central directory"); | ||
} | ||
@@ -208,3 +208,3 @@ | ||
if (offset < 0) { | ||
throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); | ||
throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); | ||
} | ||
@@ -220,3 +220,3 @@ this.reader.setIndex(offset); | ||
if (this.relativeOffsetEndOfZip64CentralDir < 0) { | ||
throw new Error("Corrupted zip : can't find the ZIP64 end of central directory"); | ||
throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); | ||
} | ||
@@ -223,0 +223,0 @@ } |
{ | ||
"name": "jszip", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"author": "Stuart Knightley <stuart@stuartk.com>", | ||
@@ -28,3 +28,3 @@ "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip", | ||
"browser": { | ||
"readable-stream": "./lib/readable-stream-browser.js" | ||
"readable-stream": "./lib/readable-stream-browser.js" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
665086
14595