Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jszip

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jszip - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

6

CHANGES.md

@@ -7,2 +7,8 @@ ---

### v3.1.3 2016-10-06
- instanceof failing in window / iframe contexts (see [#350](https://github.com/Stuk/jszip/pull/350)).
- remove a copy with blob output (see [#357](https://github.com/Stuk/jszip/pull/357)).
- fix crc32 check for empty entries (see [#358](https://github.com/Stuk/jszip/pull/358)).
- fix the base64 error message with data uri (see [#359](https://github.com/Stuk/jszip/pull/359)).
### v3.1.2 2016-08-23

@@ -9,0 +15,0 @@ - fix support of nodejs `process.platform` in `generate*` methods (see [#335](https://github.com/Stuk/jszip/pull/335)).

2

lib/base64.js

@@ -48,3 +48,3 @@ 'use strict';

if (input.substr(dataUrlPrefix.length) === dataUrlPrefix) {
if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
// This is a common error: people give a data url

@@ -51,0 +51,0 @@ // (data:image/png;base64,iVBOR...) with a {base64: true} and

@@ -45,3 +45,3 @@ 'use strict';

// a require('package.json').version doesn't work with webpack, see #327
JSZip.version = "3.1.2";
JSZip.version = "3.1.3";

@@ -48,0 +48,0 @@ JSZip.loadAsync = function (content, options) {

@@ -13,2 +13,3 @@ 'use strict';

GenericWorker.call(this, "Crc32Probe");
this.withStreamInfo("crc32", 0);
}

@@ -15,0 +16,0 @@ utils.inherits(Crc32Probe, GenericWorker);

@@ -21,3 +21,5 @@ 'use strict';

* ArrayBuffer/Blob conversion.
* @param {String} type the name of the final type
* @param {String} resultType the name of the final type
* @param {String} chunkType the type of the data in the given array.
* @param {Array} dataArray the array containing the data chunks to concatenate
* @param {String|Uint8Array|Buffer} content the content to transform

@@ -27,10 +29,13 @@ * @param {String} mimeType the mime type of the content, if applicable.

*/
function transformZipOutput(type, content, mimeType) {
switch(type) {
function transformZipOutput(resultType, chunkType, dataArray, mimeType) {
var content = null;
switch(resultType) {
case "blob" :
return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
return utils.newBlob(dataArray, mimeType);
case "base64" :
content = concat(chunkType, dataArray);
return base64.encode(content);
default :
return utils.transformTo(type, content);
content = concat(chunkType, dataArray);
return utils.transformTo(resultType, content);
}

@@ -98,3 +103,3 @@ }

try {
var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
var result = transformZipOutput(resultType, chunkType, dataArray, mimeType);
resolve(result);

@@ -121,2 +126,4 @@ } catch (e) {

case "blob":
internalType = "arraybuffer";
break;
case "arraybuffer":

@@ -123,0 +130,0 @@ internalType = "uint8array";

@@ -29,3 +29,3 @@ 'use strict';

* Create a new blob with the given content and the given type.
* @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use
* @param {Array[String|ArrayBuffer]} parts the content to put in the blob. DO NOT use
* an Uint8Array because the stock browser of android 4 won't accept it (it

@@ -36,3 +36,3 @@ * will be silently converted to a string, "[object Uint8Array]").

*/
exports.newBlob = function(part, type) {
exports.newBlob = function(parts, type) {
exports.checkSupport("blob");

@@ -42,3 +42,3 @@

// Blob constructor
return new Blob([part], {
return new Blob(parts, {
type: type

@@ -53,3 +53,5 @@ });

var builder = new Builder();
builder.append(part);
for (var i = 0; i < parts.length; i++) {
builder.append(parts[i]);
}
return builder.getBlob(type);

@@ -273,3 +275,9 @@ }

"arraybuffer": function(input) {
return input.buffer;
// copy the uint8array: DO NOT propagate the original ArrayBuffer, it
// can be way larger (the whole zip file for example).
var copy = new Uint8Array(input.length);
if (input.length) {
copy.set(input, 0);
}
return copy.buffer;
},

@@ -428,3 +436,7 @@ "uint8array": identity,

var promise = external.Promise.resolve(inputData).then(function(data) {
if (support.blob && data instanceof Blob && typeof FileReader !== "undefined") {
var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1);
if (isBlob && typeof FileReader !== "undefined") {
return new external.Promise(function (resolve, reject) {

@@ -431,0 +443,0 @@ var reader = new FileReader();

{
"name": "jszip",
"version": "3.1.2",
"version": "3.1.3",
"author": "Stuart Knightley <stuart@stuartk.com>",

@@ -5,0 +5,0 @@ "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc