| /* | ||
| * This file is used by module bundlers (browserify/webpack/etc) when | ||
| * including a stream implementation. We use "readable-stream" to get a | ||
| * consistent behavior between nodejs versions but bundlers often have a shim | ||
| * for "stream". Using this shim greatly improve the compatibility and greatly | ||
| * reduce the final size of the bundle (only one stream implementation, not | ||
| * two). | ||
| */ | ||
| module.exports = require("stream"); |
+6
-0
@@ -7,2 +7,8 @@ --- | ||
| ### v3.1.2 2016-08-23 | ||
| - fix support of nodejs `process.platform` in `generate*` methods (see [#335](https://github.com/Stuk/jszip/pull/335)). | ||
| - improve browserify/webpack support (see [#333](https://github.com/Stuk/jszip/pull/333)). | ||
| - partial support of a promise of text (see [#337](https://github.com/Stuk/jszip/pull/337)). | ||
| - fix streamed zip files containing folders (see [#342](https://github.com/Stuk/jszip/pull/342)). | ||
| ### v3.1.1 2016-08-08 | ||
@@ -9,0 +15,0 @@ - Use a hard-coded JSZip.version, fix an issue with webpack (see [#328](https://github.com/Stuk/jszip/pull/328)). |
+7
-1
@@ -0,1 +1,2 @@ | ||
| /* global Promise */ | ||
| 'use strict'; | ||
@@ -6,3 +7,8 @@ | ||
| // - the environment may have a custom Promise implementation (see zone.js) | ||
| var ES6Promise = global.Promise || require("lie"); | ||
| var ES6Promise = null; | ||
| if (typeof Promise !== "undefined") { | ||
| ES6Promise = Promise; | ||
| } else { | ||
| ES6Promise = require("lie"); | ||
| } | ||
@@ -9,0 +15,0 @@ /** |
@@ -117,5 +117,9 @@ 'use strict'; | ||
| if (streamedContent) { | ||
| // Bit 3: the sizes/crc32 are set to zero in the local header. | ||
| // The correct values are put in the data descriptor immediately | ||
| // following the compressed data. | ||
| bitflag |= 0x0008; | ||
| } | ||
| if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { | ||
| // Bit 11: Language encoding flag (EFS). | ||
| bitflag |= 0x0800; | ||
@@ -207,3 +211,2 @@ } | ||
| // general purpose bit flag | ||
| // set bit 11 if utf8 | ||
| header += decToHex(bitflag, 2); | ||
@@ -388,5 +391,7 @@ // compression method | ||
| var streamedContent = this.streamFiles && !streamInfo['file'].dir; | ||
| // don't stream folders (because they don't have any content) | ||
| if(this.streamFiles && !streamInfo['file'].dir) { | ||
| var record = generateZipParts(streamInfo, this.streamFiles, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); | ||
| if(streamedContent) { | ||
| var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); | ||
| this.push({ | ||
@@ -408,6 +413,7 @@ data : record.fileRecord, | ||
| this.accumulate = false; | ||
| var record = generateZipParts(streamInfo, this.streamFiles, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); | ||
| var streamedContent = this.streamFiles && !streamInfo['file'].dir; | ||
| var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); | ||
| this.dirRecords.push(record.dirRecord); | ||
| if(this.streamFiles && !streamInfo['file'].dir) { | ||
| if(streamedContent) { | ||
| // after the streamed file, we put data descriptors | ||
@@ -414,0 +420,0 @@ this.push({ |
+1
-1
@@ -45,3 +45,3 @@ 'use strict'; | ||
| // a require('package.json').version doesn't work with webpack, see #327 | ||
| JSZip.version = "3.1.1"; | ||
| JSZip.version = "3.1.2"; | ||
@@ -48,0 +48,0 @@ JSZip.loadAsync = function (content, options) { |
+13
-11
@@ -19,6 +19,6 @@ 'use strict'; | ||
| * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file | ||
| * @param {Object} o the options of the file | ||
| * @param {Object} originalOptions the options of the file | ||
| * @return {Object} the new file. | ||
| */ | ||
| var fileAdd = function(name, data, o) { | ||
| var fileAdd = function(name, data, originalOptions) { | ||
| // be sure sub folders exist | ||
@@ -33,3 +33,3 @@ var dataType = utils.getTypeOf(data), | ||
| o = utils.extend(o || {}, defaults); | ||
| var o = utils.extend(originalOptions || {}, defaults); | ||
| o.date = o.date || new Date(); | ||
@@ -61,3 +61,5 @@ if (o.compression !== null) { | ||
| var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; | ||
| o.binary = !isUnicodeString; | ||
| if (!originalOptions || typeof originalOptions.binary === "undefined") { | ||
| o.binary = !isUnicodeString; | ||
| } | ||
@@ -352,11 +354,11 @@ | ||
| if( | ||
| options.platform === 'darwin' || | ||
| options.platform === 'freebsd' || | ||
| options.platform === 'linux' || | ||
| options.platform === 'sunos' | ||
| opts.platform === 'darwin' || | ||
| opts.platform === 'freebsd' || | ||
| opts.platform === 'linux' || | ||
| opts.platform === 'sunos' | ||
| ) { | ||
| options.platform = "UNIX"; | ||
| opts.platform = "UNIX"; | ||
| } | ||
| if (options.platform === 'win32') { | ||
| options.platform = "DOS"; | ||
| if (opts.platform === 'win32') { | ||
| opts.platform = "DOS"; | ||
| } | ||
@@ -363,0 +365,0 @@ |
@@ -7,5 +7,12 @@ 'use strict'; | ||
| var base64 = require('../base64'); | ||
| var NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); | ||
| var support = require("../support"); | ||
| var external = require("../external"); | ||
| var NodejsStreamOutputAdapter = null; | ||
| if (support.nodestream) { | ||
| try { | ||
| NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); | ||
| } catch(e) {} | ||
| } | ||
| /** | ||
@@ -12,0 +19,0 @@ * Apply the final transformation of the data. If the user wants a Blob for |
+5
-1
@@ -34,2 +34,6 @@ 'use strict'; | ||
| exports.nodestream = !!require("./nodejs/NodejsStreamOutputAdapter").prototype; | ||
| try { | ||
| exports.nodestream = !!require('readable-stream').Readable; | ||
| } catch(e) { | ||
| exports.nodestream = false; | ||
| } |
+4
-1
| { | ||
| "name": "jszip", | ||
| "version": "3.1.1", | ||
| "version": "3.1.2", | ||
| "author": "Stuart Knightley <stuart@stuartk.com>", | ||
@@ -27,2 +27,5 @@ "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip", | ||
| "main": "./lib/index", | ||
| "browser": { | ||
| "readable-stream": "./lib/readable-stream-browser.js" | ||
| }, | ||
| "repository": { | ||
@@ -29,0 +32,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
650780
0.99%49
2.08%14334
1.13%59
-9.23%