New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pizzip

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pizzip - npm Package Compare versions

Comparing version 3.1.3 to 3.1.4

2

dist/pizzip-utils-ie.js

@@ -19,3 +19,3 @@ /*

eval("/* global IEBinaryToArray_ByteStr, IEBinaryToArray_ByteStr_Last */\n // Adapted from http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest\n\nvar IEBinaryToArray_ByteStr_Script = \"<!-- IEBinaryToArray_ByteStr -->\\r\\n\" + \"<script type='text/vbscript'>\\r\\n\" + \"Function IEBinaryToArray_ByteStr(Binary)\\r\\n\" + \" IEBinaryToArray_ByteStr = CStr(Binary)\\r\\n\" + \"End Function\\r\\n\" + \"Function IEBinaryToArray_ByteStr_Last(Binary)\\r\\n\" + \" Dim lastIndex\\r\\n\" + \" lastIndex = LenB(Binary)\\r\\n\" + \" if lastIndex mod 2 Then\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\\r\\n\" + \" Else\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = \" + '\"\"' + \"\\r\\n\" + \" End If\\r\\n\" + \"End Function\\r\\n\" + \"</script>\\r\\n\"; // inject VBScript\n\ndocument.write(IEBinaryToArray_ByteStr_Script);\n\n__webpack_require__.g.PizZipUtils._getBinaryFromXHR = function (xhr) {\n var binary = xhr.responseBody;\n var byteMapping = {};\n\n for (var i = 0; i < 256; i++) {\n for (var j = 0; j < 256; j++) {\n byteMapping[String.fromCharCode(i + (j << 8))] = String.fromCharCode(i) + String.fromCharCode(j);\n }\n }\n\n var rawBytes = IEBinaryToArray_ByteStr(binary);\n var lastChr = IEBinaryToArray_ByteStr_Last(binary);\n return rawBytes.replace(/[\\s\\S]/g, function (match) {\n return byteMapping[match];\n }) + lastChr;\n};\n\n//# sourceURL=webpack:///./es6/index_IE.js?");
eval("/* global IEBinaryToArray_ByteStr, IEBinaryToArray_ByteStr_Last */\n\n\n// Adapted from http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest\nvar IEBinaryToArray_ByteStr_Script = \"<!-- IEBinaryToArray_ByteStr -->\\r\\n\" + \"<script type='text/vbscript'>\\r\\n\" + \"Function IEBinaryToArray_ByteStr(Binary)\\r\\n\" + \" IEBinaryToArray_ByteStr = CStr(Binary)\\r\\n\" + \"End Function\\r\\n\" + \"Function IEBinaryToArray_ByteStr_Last(Binary)\\r\\n\" + \" Dim lastIndex\\r\\n\" + \" lastIndex = LenB(Binary)\\r\\n\" + \" if lastIndex mod 2 Then\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\\r\\n\" + \" Else\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = \" + '\"\"' + \"\\r\\n\" + \" End If\\r\\n\" + \"End Function\\r\\n\" + \"</script>\\r\\n\";\n\n// inject VBScript\ndocument.write(IEBinaryToArray_ByteStr_Script);\n__webpack_require__.g.PizZipUtils._getBinaryFromXHR = function (xhr) {\n var binary = xhr.responseBody;\n var byteMapping = {};\n for (var i = 0; i < 256; i++) {\n for (var j = 0; j < 256; j++) {\n byteMapping[String.fromCharCode(i + (j << 8))] = String.fromCharCode(i) + String.fromCharCode(j);\n }\n }\n var rawBytes = IEBinaryToArray_ByteStr(binary);\n var lastChr = IEBinaryToArray_ByteStr_Last(binary);\n return rawBytes.replace(/[\\s\\S]/g, function (match) {\n return byteMapping[match];\n }) + lastChr;\n};\n\n//# sourceURL=webpack:///./es6/index_IE.js?");

@@ -22,0 +22,0 @@ /***/ })

@@ -19,3 +19,3 @@ /*

eval("\n\nvar PizZipUtils = {}; // just use the responseText with xhr1, response with xhr2.\n// The transformation doesn't throw away high-order byte (with responseText)\n// because PizZip handles that case. If not used with PizZip, you may need to\n// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n\nPizZipUtils._getBinaryFromXHR = function (xhr) {\n // for xhr.responseText, the 0xFF mask is applied by PizZip\n return xhr.response || xhr.responseText;\n}; // taken from jQuery\n\n\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n}\n\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (e) {}\n} // Create the request object\n\n\nvar createXHR = window.ActiveXObject ?\n/* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\nfunction () {\n return createStandardXHR() || createActiveXHR();\n} : // For all other browsers, use the standard XMLHttpRequest object\ncreateStandardXHR;\n\nPizZipUtils.getBinaryContent = function (path, callback) {\n /*\n * Here is the tricky part : getting the data.\n * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'\n * is enough, the result is in the standard xhr.responseText.\n * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers\n * In IE <= 9, we must use (the IE only) attribute responseBody\n * (for binary data, its content is different from responseText).\n * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the\n * responseType will work :\n * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download\n *\n * I'd like to use jQuery to avoid this XHR madness, but it doesn't support\n * the responseType attribute : http://bugs.jquery.com/ticket/11461\n */\n try {\n var xhr = createXHR();\n xhr.open(\"GET\", path, true); // recent browsers\n\n if (\"responseType\" in xhr) {\n xhr.responseType = \"arraybuffer\";\n } // older browser\n\n\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\n }\n\n xhr.onreadystatechange = function (evt) {\n var file, err; // use `xhr` and not `this`... thanks IE\n\n if (xhr.readyState === 4) {\n if (xhr.status === 200 || xhr.status === 0) {\n file = null;\n err = null;\n\n try {\n file = PizZipUtils._getBinaryFromXHR(xhr);\n } catch (e) {\n err = new Error(e);\n }\n\n callback(err, file);\n } else {\n callback(new Error(\"Ajax error for \" + path + \" : \" + this.status + \" \" + this.statusText), null);\n }\n }\n };\n\n xhr.send();\n } catch (e) {\n callback(new Error(e), null);\n }\n};\n\nmodule.exports = PizZipUtils;\n\n//# sourceURL=webpack://PizZipUtils/./es6/index.js?");
eval("\n\nvar PizZipUtils = {};\n// just use the responseText with xhr1, response with xhr2.\n// The transformation doesn't throw away high-order byte (with responseText)\n// because PizZip handles that case. If not used with PizZip, you may need to\n// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\nPizZipUtils._getBinaryFromXHR = function (xhr) {\n // for xhr.responseText, the 0xFF mask is applied by PizZip\n return xhr.response || xhr.responseText;\n};\n\n// taken from jQuery\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n}\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (e) {}\n}\n\n// Create the request object\nvar createXHR = window.ActiveXObject ?\n/* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\nfunction () {\n return createStandardXHR() || createActiveXHR();\n} :\n// For all other browsers, use the standard XMLHttpRequest object\ncreateStandardXHR;\nPizZipUtils.getBinaryContent = function (path, callback) {\n /*\n * Here is the tricky part : getting the data.\n * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'\n * is enough, the result is in the standard xhr.responseText.\n * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers\n * In IE <= 9, we must use (the IE only) attribute responseBody\n * (for binary data, its content is different from responseText).\n * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the\n * responseType will work :\n * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download\n *\n * I'd like to use jQuery to avoid this XHR madness, but it doesn't support\n * the responseType attribute : http://bugs.jquery.com/ticket/11461\n */\n try {\n var xhr = createXHR();\n xhr.open(\"GET\", path, true);\n\n // recent browsers\n if (\"responseType\" in xhr) {\n xhr.responseType = \"arraybuffer\";\n }\n\n // older browser\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\n }\n xhr.onreadystatechange = function (evt) {\n var file, err;\n // use `xhr` and not `this`... thanks IE\n if (xhr.readyState === 4) {\n if (xhr.status === 200 || xhr.status === 0) {\n file = null;\n err = null;\n try {\n file = PizZipUtils._getBinaryFromXHR(xhr);\n } catch (e) {\n err = new Error(e);\n }\n callback(err, file);\n } else {\n callback(new Error(\"Ajax error for \" + path + \" : \" + this.status + \" \" + this.statusText), null);\n }\n }\n };\n xhr.send();\n } catch (e) {\n callback(new Error(e), null);\n }\n};\nmodule.exports = PizZipUtils;\n\n//# sourceURL=webpack://PizZipUtils/./es6/index.js?");

@@ -22,0 +22,0 @@ /***/ })

@@ -1,1 +0,1 @@

/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
"use strict";
var DataReader = require("./dataReader.js");
function ArrayReader(data) {

@@ -11,3 +10,2 @@ if (data) {

this.zero = 0;
for (var i = 0; i < this.data.length; i++) {

@@ -18,3 +16,2 @@ data[i] &= data[i];

}
ArrayReader.prototype = new DataReader();

@@ -24,3 +21,2 @@ /**

*/
ArrayReader.prototype.byteAt = function (i) {

@@ -32,10 +28,7 @@ return this.data[this.zero + i];

*/
ArrayReader.prototype.lastIndexOfSignature = function (sig) {
var sig0 = sig.charCodeAt(0),
sig1 = sig.charCodeAt(1),
sig2 = sig.charCodeAt(2),
sig3 = sig.charCodeAt(3);
sig1 = sig.charCodeAt(1),
sig2 = sig.charCodeAt(2),
sig3 = sig.charCodeAt(3);
for (var i = this.length - 4; i >= 0; --i) {

@@ -46,3 +39,2 @@ if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {

}
return -1;

@@ -53,11 +45,7 @@ };

*/
ArrayReader.prototype.readData = function (size) {
this.checkOffset(size);
if (size === 0) {
return [];
}
var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);

@@ -67,3 +55,2 @@ this.index += size;

};
module.exports = ArrayReader;

@@ -1,5 +0,7 @@

"use strict"; // private property
"use strict";
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encoding
// private property
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// public method for encoding
exports.encode = function (input) {

@@ -9,3 +11,2 @@ var output = "";

var i = 0;
while (i < input.length) {

@@ -19,3 +20,2 @@ chr1 = input.charCodeAt(i++);

enc4 = chr3 & 63;
if (isNaN(chr2)) {

@@ -26,10 +26,8 @@ enc3 = enc4 = 64;

}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}; // public method for decoding
};
// public method for decoding
exports.decode = function (input) {

@@ -41,3 +39,2 @@ var output = "";

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {

@@ -52,7 +49,5 @@ enc1 = _keyStr.indexOf(input.charAt(i++));

output += String.fromCharCode(chr1);
if (enc3 !== 64) {
output += String.fromCharCode(chr2);
}
if (enc4 !== 64) {

@@ -62,4 +57,3 @@ output += String.fromCharCode(chr3);

}
return output;
};

@@ -10,3 +10,2 @@ "use strict";

}
CompressedObject.prototype = {

@@ -21,3 +20,2 @@ /**

},
/**

@@ -32,2 +30,3 @@ * Return the compressed content in an unspecified format.

};
module.exports = CompressedObject;

@@ -11,2 +11,3 @@ "use strict";

},
compressInputType: null,

@@ -13,0 +14,0 @@ uncompressInputType: null

"use strict";
var utils = require("./utils.js"); // prettier-ignore
var utils = require("./utils.js");
// prettier-ignore
var table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D];
var table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D];
/**

@@ -13,3 +14,2 @@ *

*/
module.exports = function crc32(input, crc) {

@@ -19,9 +19,6 @@ if (typeof input === "undefined" || !input.length) {

}
var isArray = utils.getTypeOf(input) !== "string";
if (typeof crc == "undefined") {
crc = 0;
}
var x = 0;

@@ -31,3 +28,2 @@ var y = 0;

crc ^= -1;
for (var i = 0, iTop = input.length; i < iTop; i++) {

@@ -39,4 +35,3 @@ b = isArray ? input[i] : input.charCodeAt(i);

}
return crc ^ -1;
};
"use strict";
var utils = require("./utils.js");
function DataReader() {
this.data = null; // type : see implementation
this.length = 0;

@@ -12,3 +10,2 @@ this.index = 0;

}
DataReader.prototype = {

@@ -23,3 +20,2 @@ /**

},
/**

@@ -35,3 +31,2 @@ * Check that the specifed index will not be too far.

},
/**

@@ -46,3 +41,2 @@ * Change the index.

},
/**

@@ -56,3 +50,2 @@ * Skip the next n bytes.

},
/**

@@ -63,5 +56,5 @@ * Get the byte at the specified index.

*/
byteAt: function byteAt() {// see implementations
byteAt: function byteAt() {
// see implementations
},
/**

@@ -74,13 +67,10 @@ * Get the next number with a given byte size.

var result = 0,
i;
i;
this.checkOffset(size);
for (i = this.index + size - 1; i >= this.index; i--) {
result = (result << 8) + this.byteAt(i);
}
this.index += size;
return result;
},
/**

@@ -94,3 +84,2 @@ * Get the next string with a given byte size.

},
/**

@@ -101,5 +90,5 @@ * Get raw data without conversion, <size> bytes.

*/
readData: function readData() {// see implementations
readData: function readData() {
// see implementations
},
/**

@@ -110,5 +99,5 @@ * Find the last occurence of a zip signature (4 bytes).

*/
lastIndexOfSignature: function lastIndexOfSignature() {// see implementations
lastIndexOfSignature: function lastIndexOfSignature() {
// see implementations
},
/**

@@ -120,10 +109,16 @@ * Get the next date.

var dostime = this.readInt(4);
return new Date((dostime >> 25 & 0x7f) + 1980, // year
(dostime >> 21 & 0x0f) - 1, // month
dostime >> 16 & 0x1f, // day
dostime >> 11 & 0x1f, // hour
dostime >> 5 & 0x3f, // minute
return new Date((dostime >> 25 & 0x7f) + 1980,
// year
(dostime >> 21 & 0x0f) - 1,
// month
dostime >> 16 & 0x1f,
// day
dostime >> 11 & 0x1f,
// hour
dostime >> 5 & 0x3f,
// minute
(dostime & 0x1f) << 1); // second
}
};
module.exports = DataReader;
"use strict";
var utils = require("./utils.js");
/**

@@ -8,7 +9,6 @@ * @deprecated

*/
exports.string2binary = function (str) {
return utils.string2binary(str);
};
/**

@@ -18,7 +18,6 @@ * @deprecated

*/
exports.string2Uint8Array = function (str) {
return utils.transformTo("uint8array", str);
};
/**

@@ -28,7 +27,6 @@ * @deprecated

*/
exports.uint8Array2String = function (array) {
return utils.transformTo("string", array);
};
/**

@@ -38,4 +36,2 @@ * @deprecated

*/
exports.string2Blob = function (str) {

@@ -45,2 +41,3 @@ var buffer = utils.transformTo("arraybuffer", str);

};
/**

@@ -50,7 +47,6 @@ * @deprecated

*/
exports.arrayBuffer2Blob = function (buffer) {
return utils.arrayBuffer2Blob(buffer);
};
/**

@@ -60,7 +56,6 @@ * @deprecated

*/
exports.transformTo = function (outputType, input) {
return utils.transformTo(outputType, input);
};
/**

@@ -70,7 +65,6 @@ * @deprecated

*/
exports.getTypeOf = function (input) {
return utils.getTypeOf(input);
};
/**

@@ -80,7 +74,6 @@ * @deprecated

*/
exports.checkSupport = function (type) {
return utils.checkSupport(type);
};
/**

@@ -90,5 +83,4 @@ * @deprecated

*/
exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS;
exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS;
/**

@@ -98,4 +90,4 @@ * @deprecated

*/
exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS;
exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS;
/**

@@ -105,6 +97,6 @@ * @deprecated

*/
exports.pretty = function (str) {
return utils.pretty(str);
};
/**

@@ -114,7 +106,6 @@ * @deprecated

*/
exports.findCompression = function (compressionMethod) {
return utils.findCompression(compressionMethod);
};
/**

@@ -124,6 +115,4 @@ * @deprecated

*/
exports.isRegExp = function (object) {
return utils.isRegExp(object);
};
"use strict";
var USE_TYPEDARRAY = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Uint32Array !== "undefined";
var pako = require("pako/dist/pako.es5.js");
exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array";
exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array";
exports.magic = "\x08\x00";
exports.compress = function (input, compressionOptions) {
return pako.deflateRaw(input, {
level: compressionOptions.level || -1 // default compression
});

@@ -16,0 +12,0 @@ };

"use strict";
var base64 = require("./base64.js");
/**

@@ -22,4 +23,2 @@ Usage:

*/
function PizZip(data, options) {

@@ -29,3 +28,5 @@ // if this constructor is used without `new`, it adds `new` before itself:

return new PizZip(data, options);
} // object containing the files :
}
// object containing the files :
// {

@@ -35,16 +36,12 @@ // "folder/" : {...},

// }
this.files = {};
this.comment = null; // Where we are in the hierarchy
this.comment = null;
// Where we are in the hierarchy
this.root = "";
if (data) {
this.load(data, options);
}
this.clone = function () {
var _this = this;
var newObj = new PizZip();

@@ -56,6 +53,4 @@ Object.keys(this.files).forEach(function (file) {

};
this.shallowClone = function () {
var newObj = new PizZip();
for (var i in this) {

@@ -66,7 +61,5 @@ if (typeof this[i] !== "function") {

}
return newObj;
};
}
PizZip.prototype = require("./object.js");

@@ -76,2 +69,3 @@ PizZip.prototype.load = require("./load.js");

PizZip.defaults = require("./defaults.js");
/**

@@ -81,3 +75,2 @@ * @deprecated

*/
PizZip.utils = require("./deprecatedPublicUtils.js");

@@ -92,3 +85,2 @@ PizZip.base64 = {

},
/**

@@ -95,0 +87,0 @@ * @deprecated

"use strict";
var base64 = require("./base64.js");
var utf8 = require("./utf8.js");
var utils = require("./utils.js");
var ZipEntries = require("./zipEntries.js");
module.exports = function (data, options) {

@@ -20,10 +16,7 @@ var i, input;

});
if (options.base64) {
data = base64.decode(data);
}
var zipEntries = new ZipEntries(data, options);
var files = zipEntries.files;
for (i = 0; i < files.length; i++) {

@@ -42,8 +35,6 @@ input = files[i];

}
if (zipEntries.zipComment.length) {
this.comment = zipEntries.zipComment;
}
return this;
};

@@ -7,8 +7,6 @@ "use strict";

}
return Buffer.from(data, encoding);
};
module.exports.test = function (b) {
return Buffer.isBuffer(b);
};
"use strict";
var Uint8ArrayReader = require("./uint8ArrayReader.js");
function NodeBufferReader(data) {

@@ -11,8 +10,7 @@ this.data = data;

}
NodeBufferReader.prototype = new Uint8ArrayReader();
NodeBufferReader.prototype = new Uint8ArrayReader();
/**
* @see DataReader.readData
*/
NodeBufferReader.prototype.readData = function (size) {

@@ -24,3 +22,2 @@ this.checkOffset(size);

};
module.exports = NodeBufferReader;
"use strict";
var support = require("./support.js");
var utils = require("./utils.js");
var _crc = require("./crc32.js");
var signature = require("./signature.js");
var defaults = require("./defaults.js");
var base64 = require("./base64.js");
var compressions = require("./compressions.js");
var CompressedObject = require("./compressedObject.js");
var nodeBuffer = require("./nodeBuffer.js");
var utf8 = require("./utf8.js");
var StringWriter = require("./stringWriter.js");
var Uint8ArrayWriter = require("./uint8ArrayWriter.js");
var Uint8ArrayWriter = require("./uint8ArrayWriter.js");
/**

@@ -31,4 +21,2 @@ * Returns the raw data of a ZipObject, decompress the content if necessary.

*/
function getRawData(file) {

@@ -39,9 +27,8 @@ if (file._data instanceof CompressedObject) {

file.options.base64 = false;
if (utils.getTypeOf(file._data) === "uint8array") {
var copy = file._data; // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.
var copy = file._data;
// when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.
// if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file).
file._data = new Uint8Array(copy.length); // with an empty Uint8Array, Opera fails with a "Offset larger than array size"
file._data = new Uint8Array(copy.length);
// with an empty Uint8Array, Opera fails with a "Offset larger than array size"
if (copy.length !== 0) {

@@ -52,5 +39,5 @@ file._data.set(copy, 0);

}
return file._data;
}
/**

@@ -61,8 +48,5 @@ * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it.

*/
function getBinaryData(file) {
var result = getRawData(file),
type = utils.getTypeOf(result);
type = utils.getTypeOf(result);
if (type === "string") {

@@ -76,10 +60,8 @@ if (!file.options.binary) {

}
return file.asBinary();
}
return result;
} // return the actual prototype of PizZip
}
// return the actual prototype of PizZip
var out = {

@@ -97,3 +79,2 @@ /**

},
/**

@@ -109,3 +90,2 @@ * Filter nested files/folders with the specified function.

var filename, relativePath, file, fileClone;
for (filename in this.files) {

@@ -115,9 +95,8 @@ if (!this.files.hasOwnProperty(filename)) {

}
file = this.files[filename]; // return a new object, don't let the user mess with our internal objects :)
file = this.files[filename];
// return a new object, don't let the user mess with our internal objects :)
fileClone = new ZipObject(file.name, file._data, utils.extend(file.options));
relativePath = filename.slice(this.root.length, filename.length);
if (filename.slice(0, this.root.length) === this.root && // the file is in the current root
if (filename.slice(0, this.root.length) === this.root &&
// the file is in the current root
search(relativePath, fileClone)) {

@@ -128,6 +107,4 @@ // and the file matches the function

}
return result;
},
/**

@@ -149,11 +126,9 @@ * Add a file to the zip file, or search a file.

});
} // text
}
// text
return this.filter(function (relativePath, file) {
return !file.dir && relativePath === name;
})[0] || null;
} // more than one argument : we have data !
}
// more than one argument : we have data !
name = this.root + name;

@@ -163,3 +138,2 @@ fileAdd.call(this, name, data, o);

},
/**

@@ -174,3 +148,2 @@ * Add a directory to the zip file, or search.

}
if (utils.isRegExp(arg)) {

@@ -180,8 +153,9 @@ return this.filter(function (relativePath, file) {

});
} // else, name is a new folder
}
// else, name is a new folder
var name = this.root + arg;
var newFolder = folderAdd.call(this, name); // Allow chaining by returning a new object with this folder as the root
var newFolder = folderAdd.call(this, name);
// Allow chaining by returning a new object with this folder as the root
var ret = this.shallowClone();

@@ -191,3 +165,2 @@ ret.root = newFolder.name;

},
/**

@@ -201,3 +174,2 @@ * Delete a file, or a directory and all sub-files, from the zip

var file = this.files[name];
if (!file) {

@@ -208,6 +180,4 @@ // Look for any folders

}
file = this.files[name];
}
if (file && !file.dir) {

@@ -221,3 +191,2 @@ // file

});
for (var i = 0; i < kids.length; i++) {

@@ -227,6 +196,4 @@ delete this.files[kids[i].name];

}
return this;
},
/**

@@ -251,19 +218,19 @@ * Generate the complete zip file

});
utils.checkSupport(options.type); // accept nodejs `process.platform`
utils.checkSupport(options.type);
// accept nodejs `process.platform`
if (options.platform === "darwin" || options.platform === "freebsd" || options.platform === "linux" || options.platform === "sunos") {
options.platform = "UNIX";
}
if (options.platform === "win32") {
options.platform = "DOS";
}
var zipData = [],
encodedComment = utils.transformTo("string", options.encodeFileName(options.comment || this.comment || ""));
encodedComment = utils.transformTo("string", options.encodeFileName(options.comment || this.comment || ""));
var localDirLength = 0,
centralDirLength = 0,
writer,
i; // first, generate all the zip parts.
centralDirLength = 0,
writer,
i;
// first, generate all the zip parts.
for (var name in this.files) {

@@ -273,11 +240,8 @@ if (!this.files.hasOwnProperty(name)) {

}
var file = this.files[name];
var compressionName = file.options.compression || options.compression.toUpperCase();
var compression = compressions[compressionName];
if (!compression) {
throw new Error(compressionName + " is not a valid compression method !");
}
var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};

@@ -290,18 +254,26 @@ var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions);

}
var dirEnd = "";
var dirEnd = ""; // end of central dir signature
// end of central dir signature
dirEnd = signature.CENTRAL_DIRECTORY_END +
// number of this disk
"\x00\x00" +
// number of the disk with the start of the central directory
"\x00\x00" +
// total number of entries in the central directory on this disk
decToHex(zipData.length, 2) +
// total number of entries in the central directory
decToHex(zipData.length, 2) +
// size of the central directory 4 bytes
decToHex(centralDirLength, 4) +
// offset of start of central directory with respect to the starting disk number
decToHex(localDirLength, 4) +
// .ZIP file comment length
decToHex(encodedComment.length, 2) +
// .ZIP file comment
encodedComment;
dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk
"\x00\x00" + // number of the disk with the start of the central directory
"\x00\x00" + // total number of entries in the central directory on this disk
decToHex(zipData.length, 2) + // total number of entries in the central directory
decToHex(zipData.length, 2) + // size of the central directory 4 bytes
decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number
decToHex(localDirLength, 4) + // .ZIP file comment length
decToHex(encodedComment.length, 2) + // .ZIP file comment
encodedComment; // we have all the parts (and the total length)
// we have all the parts (and the total length)
// time to create a writer !
var typeName = options.type.toLowerCase();
if (typeName === "uint8array" || typeName === "arraybuffer" || typeName === "blob" || typeName === "nodebuffer") {

@@ -312,3 +284,2 @@ writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);

}
for (i = 0; i < zipData.length; i++) {

@@ -318,10 +289,7 @@ writer.append(zipData[i].fileRecord);

}
for (i = 0; i < zipData.length; i++) {
writer.append(zipData[i].dirRecord);
}
writer.append(dirEnd);
var zip = writer.finalize();
switch (options.type.toLowerCase()) {

@@ -333,10 +301,7 @@ // case "zip is an Uint8Array"

return utils.transformTo(options.type.toLowerCase(), zip);
case "blob":
return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip), options.mimeType);
// case "zip is a string"
case "base64":
return options.base64 ? base64.encode(zip) : zip;
default:

@@ -347,3 +312,2 @@ // case "string" :

},
/**

@@ -356,3 +320,2 @@ * @deprecated

},
/**

@@ -365,3 +328,2 @@ * @deprecated

},
/**

@@ -380,15 +342,11 @@ * @deprecated

*/
function dataToString(asUTF8) {
var result = getRawData(this);
if (result === null || typeof result === "undefined") {
return "";
} // if the data is a base64 string, we decode it before checking the encoding !
}
// if the data is a base64 string, we decode it before checking the encoding !
if (this.options.base64) {
result = base64.decode(result);
}
if (asUTF8 && this.options.binary) {

@@ -402,7 +360,5 @@ // PizZip.prototype.utf8decode supports arrays as input

}
if (!asUTF8 && !this.options.binary) {
result = utils.transformTo("string", out.utf8encode(result));
}
return result;

@@ -417,4 +373,2 @@ }

*/
function ZipObject(name, data, options) {

@@ -429,2 +383,3 @@ this.name = name;

this.options = options;
/*

@@ -435,3 +390,2 @@ * This object contains initial values for dir and date.

*/
this._initialMetadata = {

@@ -442,3 +396,2 @@ dir: options.dir,

}
ZipObject.prototype = {

@@ -452,3 +405,2 @@ /**

},
/**

@@ -461,3 +413,2 @@ * Returns the binary content.

},
/**

@@ -471,3 +422,2 @@ * Returns the content as a nodejs Buffer.

},
/**

@@ -481,3 +431,2 @@ * Returns the content as an Uint8Array.

},
/**

@@ -491,2 +440,3 @@ * Returns the content as an ArrayBuffer.

};
/**

@@ -499,7 +449,5 @@ * Transform an integer into a string in hexadecimal.

*/
function decToHex(dec, bytes) {
var hex = "",
i;
i;
for (i = 0; i < bytes; i++) {

@@ -509,5 +457,5 @@ hex += String.fromCharCode(dec & 0xff);

}
return hex;
}
/**

@@ -520,20 +468,15 @@ * Transforms the (incomplete) options from the user into the complete

*/
function prepareFileAttrs(o) {
o = o || {};
if (o.base64 === true && (o.binary === null || o.binary === undefined)) {
o.binary = true;
}
o = utils.extend(o, defaults);
o.date = o.date || new Date();
if (o.compression !== null) {
o.compression = o.compression.toUpperCase();
}
return o;
}
/**

@@ -547,32 +490,25 @@ * Add a file in the current folder.

*/
function fileAdd(name, data, o) {
// be sure sub folders exist
var dataType = utils.getTypeOf(data),
parent;
parent;
o = prepareFileAttrs(o);
if (typeof o.unixPermissions === "string") {
o.unixPermissions = parseInt(o.unixPermissions, 8);
} // UNX_IFDIR 0040000 see zipinfo.c
}
// UNX_IFDIR 0040000 see zipinfo.c
if (o.unixPermissions && o.unixPermissions & 0x4000) {
o.dir = true;
} // Bit 4 Directory
}
// Bit 4 Directory
if (o.dosPermissions && o.dosPermissions & 0x0010) {
o.dir = true;
}
if (o.dir) {
name = forceTrailingSlash(name);
}
if (o.createFolders && (parent = parentFolder(name))) {
folderAdd.call(this, parent, true);
}
if (o.dir || data === null || typeof data === "undefined") {

@@ -596,8 +532,7 @@ o.base64 = false;

o.binary = true;
if (!dataType && !(data instanceof CompressedObject)) {
throw new Error("The data of '" + name + "' is in an unsupported format !");
} // special case : it's way easier to work with Uint8Array than with ArrayBuffer
}
// special case : it's way easier to work with Uint8Array than with ArrayBuffer
if (dataType === "arraybuffer") {

@@ -607,3 +542,2 @@ data = utils.transformTo("uint8array", data);

}
var object = new ZipObject(name, data, o);

@@ -613,2 +547,3 @@ this.files[name] = object;

}
/**

@@ -620,4 +555,2 @@ * Find the parent folder of the path.

*/
function parentFolder(path) {

@@ -627,6 +560,6 @@ if (path.slice(-1) === "/") {

}
var lastSlash = path.lastIndexOf("/");
return lastSlash > 0 ? path.substring(0, lastSlash) : "";
}
/**

@@ -638,4 +571,2 @@ * Returns the path with a slash at the end.

*/
function forceTrailingSlash(path) {

@@ -657,8 +588,7 @@ // Check the name ends with a /

*/
function folderAdd(name, createFolders) {
createFolders = typeof createFolders !== "undefined" ? createFolders : false;
name = forceTrailingSlash(name); // Does this folder already exist?
name = forceTrailingSlash(name);
// Does this folder already exist?
if (!this.files[name]) {

@@ -670,5 +600,5 @@ fileAdd.call(this, name, null, {

}
return this.files[name];
}
/**

@@ -681,12 +611,10 @@ * Generate a PizZip.CompressedObject for a given zipOject.

*/
function generateCompressedObjectFrom(file, compression, compressionOptions) {
var result = new CompressedObject();
var content; // the data has not been decompressed, we might reuse things !
var content;
// the data has not been decompressed, we might reuse things !
if (file._data instanceof CompressedObject) {
result.uncompressedSize = file._data.uncompressedSize;
result.crc32 = file._data.crc32;
if (result.uncompressedSize === 0 || file.dir) {

@@ -699,4 +627,4 @@ compression = compressions.STORE;

} else {
content = file._data.getContent(); // need to decompress / recompress
content = file._data.getContent();
// need to decompress / recompress
result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);

@@ -707,3 +635,2 @@ }

content = getBinaryData(file);
if (!content || content.length === 0 || file.dir) {

@@ -713,3 +640,2 @@ compression = compressions.STORE;

}
result.uncompressedSize = content.length;

@@ -719,3 +645,2 @@ result.crc32 = _crc(content);

}
result.compressedSize = result.compressedContent.length;

@@ -725,2 +650,3 @@ result.compressionMethod = compression.magic;

}
/**

@@ -741,7 +667,4 @@ * Generate the UNIX part of the external file attributes.

*/
function generateUnixExternalFileAttr(unixPermissions, isDir) {
var result = unixPermissions;
if (!unixPermissions) {

@@ -753,5 +676,5 @@ // I can't use octal values in strict mode, hence the hexa.

}
return (result & 0xffff) << 16;
}
/**

@@ -770,8 +693,8 @@ * Generate the DOS part of the external file attributes.

*/
function generateDosExternalFileAttr(dosPermissions) {
// the dir flag is already set for compatibility
return (dosPermissions || 0) & 0x3f;
}
/**

@@ -787,22 +710,21 @@ * Generate the various parts used in the construction of the final zip file.

*/
function generateZipParts(name, file, compressedObject, offset, platform, encodeFileName) {
var useCustomEncoding = encodeFileName !== utf8.utf8encode,
encodedFileName = utils.transformTo("string", encodeFileName(file.name)),
utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)),
comment = file.comment || "",
encodedComment = utils.transformTo("string", encodeFileName(comment)),
utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)),
useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,
useUTF8ForComment = utfEncodedComment.length !== comment.length,
o = file.options;
encodedFileName = utils.transformTo("string", encodeFileName(file.name)),
utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)),
comment = file.comment || "",
encodedComment = utils.transformTo("string", encodeFileName(comment)),
utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)),
useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,
useUTF8ForComment = utfEncodedComment.length !== comment.length,
o = file.options;
var dosTime,
dosDate,
extraFields = "",
unicodePathExtraField = "",
unicodeCommentExtraField = "",
dir,
date; // handle the deprecated options.dir
dosDate,
extraFields = "",
unicodePathExtraField = "",
unicodeCommentExtraField = "",
dir,
date;
// handle the deprecated options.dir
if (file._initialMetadata.dir !== file.dir) {

@@ -812,5 +734,5 @@ dir = file.dir;

dir = o.dir;
} // handle the deprecated options.date
}
// handle the deprecated options.date
if (file._initialMetadata.date !== file.date) {

@@ -821,6 +743,4 @@ date = file.date;

}
var extFileAttr = 0;
var versionMadeBy = 0;
if (dir) {

@@ -830,6 +750,4 @@ // dos or unix, we set the dos dir flag

}
if (platform === "UNIX") {
versionMadeBy = 0x031e; // UNIX, version 3.0
extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);

@@ -839,5 +757,6 @@ } else {

versionMadeBy = 0x0014; // DOS, version 2.0
extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);
}
extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);
} // date
// date
// @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html

@@ -847,3 +766,2 @@ // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html

dosTime = date.getHours();

@@ -859,3 +777,2 @@ dosTime <<= 6;

dosDate |= date.getDate();
if (useUTF8ForFileName) {

@@ -871,56 +788,77 @@ // set the unicode path extra field. unzip needs at least one extra

// So for now, UTF-8 everywhere !
unicodePathExtraField = // Version
decToHex(1, 1) + // NameCRC32
decToHex(_crc(encodedFileName), 4) + // UnicodeName
unicodePathExtraField =
// Version
decToHex(1, 1) +
// NameCRC32
decToHex(_crc(encodedFileName), 4) +
// UnicodeName
utfEncodedFileName;
extraFields += // Info-ZIP Unicode Path Extra Field
"\x75\x70" + // size
decToHex(unicodePathExtraField.length, 2) + // content
extraFields +=
// Info-ZIP Unicode Path Extra Field
"\x75\x70" +
// size
decToHex(unicodePathExtraField.length, 2) +
// content
unicodePathExtraField;
}
if (useUTF8ForComment) {
unicodeCommentExtraField = // Version
decToHex(1, 1) + // CommentCRC32
decToHex(this.crc32(encodedComment), 4) + // UnicodeName
unicodeCommentExtraField =
// Version
decToHex(1, 1) +
// CommentCRC32
decToHex(this.crc32(encodedComment), 4) +
// UnicodeName
utfEncodedComment;
extraFields += // Info-ZIP Unicode Path Extra Field
"\x75\x63" + // size
decToHex(unicodeCommentExtraField.length, 2) + // content
extraFields +=
// Info-ZIP Unicode Path Extra Field
"\x75\x63" +
// size
decToHex(unicodeCommentExtraField.length, 2) +
// content
unicodeCommentExtraField;
}
var header = "";
var header = ""; // version needed to extract
header += "\x0A\x00"; // general purpose bit flag
// version needed to extract
header += "\x0A\x00";
// general purpose bit flag
// set bit 11 if utf8
header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; // compression method
header += compressedObject.compressionMethod; // last mod file time
header += decToHex(dosTime, 2); // last mod file date
header += decToHex(dosDate, 2); // crc-32
header += decToHex(compressedObject.crc32, 4); // compressed size
header += decToHex(compressedObject.compressedSize, 4); // uncompressed size
header += decToHex(compressedObject.uncompressedSize, 4); // file name length
header += decToHex(encodedFileName.length, 2); // extra field length
header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00";
// compression method
header += compressedObject.compressionMethod;
// last mod file time
header += decToHex(dosTime, 2);
// last mod file date
header += decToHex(dosDate, 2);
// crc-32
header += decToHex(compressedObject.crc32, 4);
// compressed size
header += decToHex(compressedObject.compressedSize, 4);
// uncompressed size
header += decToHex(compressedObject.uncompressedSize, 4);
// file name length
header += decToHex(encodedFileName.length, 2);
// extra field length
header += decToHex(extraFields.length, 2);
var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;
var dirRecord = signature.CENTRAL_FILE_HEADER + // version made by (00: DOS)
decToHex(versionMadeBy, 2) + // file header (common to file and central directory)
header + // file comment length
decToHex(encodedComment.length, 2) + // disk number start
"\x00\x00" + // internal file attributes
"\x00\x00" + // external file attributes
decToHex(extFileAttr, 4) + // relative offset of local header
decToHex(offset, 4) + // file name
encodedFileName + // extra field
extraFields + // file comment
var dirRecord = signature.CENTRAL_FILE_HEADER +
// version made by (00: DOS)
decToHex(versionMadeBy, 2) +
// file header (common to file and central directory)
header +
// file comment length
decToHex(encodedComment.length, 2) +
// disk number start
"\x00\x00" +
// internal file attributes
"\x00\x00" +
// external file attributes
decToHex(extFileAttr, 4) +
// relative offset of local header
decToHex(offset, 4) +
// file name
encodedFileName +
// extra field
extraFields +
// file comment
encodedComment;

@@ -933,3 +871,2 @@ return {

}
module.exports = out;
"use strict";
var DataReader = require("./dataReader.js");
var utils = require("./utils.js");
function StringReader(data, optimizedBinaryString) {
this.data = data;
if (!optimizedBinaryString) {
this.data = utils.string2binary(this.data);
}
this.length = this.data.length;

@@ -18,3 +14,2 @@ this.index = 0;

}
StringReader.prototype = new DataReader();

@@ -24,3 +19,2 @@ /**

*/
StringReader.prototype.byteAt = function (i) {

@@ -32,4 +26,2 @@ return this.data.charCodeAt(this.zero + i);

*/
StringReader.prototype.lastIndexOfSignature = function (sig) {

@@ -41,7 +33,5 @@ return this.data.lastIndexOf(sig) - this.zero;

*/
StringReader.prototype.readData = function (size) {
this.checkOffset(size); // this will work because the constructor applied the "& 0xff" mask.
this.checkOffset(size);
// this will work because the constructor applied the "& 0xff" mask.
var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);

@@ -51,3 +41,2 @@ this.index += size;

};
module.exports = StringReader;
"use strict";
var utils = require("./utils.js");
/**

@@ -8,8 +9,5 @@ * An object to write any content to a string.

*/
function StringWriter() {
this.data = [];
}
StringWriter.prototype = {

@@ -24,3 +22,2 @@ /**

},
/**

@@ -27,0 +24,0 @@ * Finalize the construction an return the result.

@@ -6,10 +6,9 @@ "use strict";

exports.string = true;
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; // contains true if PizZip can read/generate nodejs Buffer, false otherwise.
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
// contains true if PizZip can read/generate nodejs Buffer, false otherwise.
// Browserify will provide a Buffer implementation for browsers, which is
// an augmented Uint8Array (i.e., can be used as either Buffer or U8).
exports.nodebuffer = typeof Buffer !== "undefined"; // contains true if PizZip can read/generate Uint8Array, false otherwise.
exports.nodebuffer = typeof Buffer !== "undefined";
// contains true if PizZip can read/generate Uint8Array, false otherwise.
exports.uint8array = typeof Uint8Array !== "undefined";
if (typeof ArrayBuffer === "undefined") {

@@ -19,3 +18,2 @@ exports.blob = false;

var buffer = new ArrayBuffer(0);
try {

@@ -22,0 +20,0 @@ exports.blob = new Blob([buffer], {

"use strict";
var ArrayReader = require("./arrayReader.js");
function Uint8ArrayReader(data) {

@@ -13,3 +12,2 @@ if (data) {

}
Uint8ArrayReader.prototype = new ArrayReader();

@@ -19,6 +17,4 @@ /**

*/
Uint8ArrayReader.prototype.readData = function (size) {
this.checkOffset(size);
if (size === 0) {

@@ -28,3 +24,2 @@ // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].

}
var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);

@@ -34,3 +29,2 @@ this.index += size;

};
module.exports = Uint8ArrayReader;
"use strict";
var utils = require("./utils.js");
/**

@@ -9,4 +10,2 @@ * An object to write any content to an Uint8Array.

*/
function Uint8ArrayWriter(length) {

@@ -16,3 +15,2 @@ this.data = new Uint8Array(length);

}
Uint8ArrayWriter.prototype = {

@@ -31,3 +29,2 @@ /**

},
/**

@@ -34,0 +31,0 @@ * Finalize the construction an return the result.

"use strict";
var utils = require("./utils.js");
var support = require("./support.js");
var nodeBuffer = require("./nodeBuffer.js");
var nodeBuffer = require("./nodeBuffer.js");
/**

@@ -12,31 +11,27 @@ * The following functions come from pako, from pako/lib/utils/strings

*/
// Table with utf8 lengths (calculated by first byte of sequence)
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new Array(256);
for (var i = 0; i < 256; i++) {
_utf8len[i] = i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1;
}
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
// convert string to array (typed, when possible)
function string2buf(str) {
var buf,
c,
c2,
mPos,
i,
bufLen = 0;
var strLen = str.length; // count binary size
c,
c2,
mPos,
i,
bufLen = 0;
var strLen = str.length;
// count binary size
for (mPos = 0; mPos < strLen; mPos++) {
c = str.charCodeAt(mPos);
if ((c & 0xfc00) === 0xd800 && mPos + 1 < strLen) {
c2 = str.charCodeAt(mPos + 1);
if ((c2 & 0xfc00) === 0xdc00) {

@@ -47,7 +42,6 @@ c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);

}
bufLen += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
} // allocate buffer
}
// allocate buffer
if (support.uint8array) {

@@ -57,11 +51,9 @@ buf = new Uint8Array(bufLen);

buf = new Array(bufLen);
} // convert
}
// convert
for (i = 0, mPos = 0; i < bufLen; mPos++) {
c = str.charCodeAt(mPos);
if ((c & 0xfc00) === 0xd800 && mPos + 1 < strLen) {
c2 = str.charCodeAt(mPos + 1);
if ((c2 & 0xfc00) === 0xdc00) {

@@ -72,3 +64,2 @@ c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);

}
if (c < 0x80) {

@@ -94,5 +85,6 @@ /* one byte */

}
return buf;
}
return buf;
} // Calculate max possible position in utf8 buffer,
// Calculate max possible position in utf8 buffer,
// that will not break sequence. If that's not possible

@@ -103,46 +95,41 @@ // - (very small limits) return max size as is.

// max - length limit (mandatory);
function utf8border(buf, max) {
var pos;
max = max || buf.length;
if (max > buf.length) {
max = buf.length;
} // go back from last position, until start of sequence found
}
// go back from last position, until start of sequence found
pos = max - 1;
while (pos >= 0 && (buf[pos] & 0xc0) === 0x80) {
pos--;
} // Fuckup - very small and broken sequence,
}
// Fuckup - very small and broken sequence,
// return max, because we should return something anyway.
if (pos < 0) {
return max;
} // If we came to start of buffer - that means vuffer is too small,
}
// If we came to start of buffer - that means vuffer is too small,
// return max too.
if (pos === 0) {
return max;
}
return pos + _utf8len[buf[pos]] > max ? pos : max;
} // convert array to string
}
// convert array to string
function buf2string(buf) {
var i, out, c, cLen;
var len = buf.length; // Reserve max possible length (2 words per char)
var len = buf.length;
// Reserve max possible length (2 words per char)
// NB: by unknown reasons, Array is significantly faster for
// String.fromCharCode.apply than Uint16Array.
var utf16buf = new Array(len * 2);
for (out = 0, i = 0; i < len;) {
c = buf[i++]; // quick process ascii
c = buf[i++];
// quick process ascii
if (c < 0x80) {

@@ -152,5 +139,4 @@ utf16buf[out++] = c;

}
cLen = _utf8len[c]; // skip 5 & 6 byte codes
cLen = _utf8len[c];
// skip 5 & 6 byte codes
if (cLen > 4) {

@@ -160,13 +146,13 @@ utf16buf[out++] = 0xfffd;

continue;
} // apply mask on first byte
}
c &= cLen === 2 ? 0x1f : cLen === 3 ? 0x0f : 0x07; // join the rest
// apply mask on first byte
c &= cLen === 2 ? 0x1f : cLen === 3 ? 0x0f : 0x07;
// join the rest
while (cLen > 1 && i < len) {
c = c << 6 | buf[i++] & 0x3f;
cLen--;
} // terminated by end of string?
}
// terminated by end of string?
if (cLen > 1) {

@@ -176,3 +162,2 @@ utf16buf[out++] = 0xfffd;

}
if (c < 0x10000) {

@@ -185,5 +170,5 @@ utf16buf[out++] = c;

}
} // shrinkBuf(utf16buf, out)
}
// shrinkBuf(utf16buf, out)
if (utf16buf.length !== out) {

@@ -195,8 +180,10 @@ if (utf16buf.subarray) {

}
} // return String.fromCharCode.apply(null, utf16buf);
}
// return String.fromCharCode.apply(null, utf16buf);
return utils.applyFromCharCode(utf16buf);
} // That's all for the pako functions.
}
// That's all for the pako functions.
/**

@@ -208,4 +195,2 @@ * Transform a javascript string into an array (typed if possible) of bytes,

*/
exports.utf8encode = function utf8encode(str) {

@@ -215,5 +200,5 @@ if (support.nodebuffer) {

}
return string2buf(str);
};
/**

@@ -225,4 +210,2 @@ * Transform a bytes array (or a representation) representing an UTF-8 encoded

*/
exports.utf8decode = function utf8decode(buf) {

@@ -232,16 +215,14 @@ if (support.nodebuffer) {

}
buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf);
buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); // return buf2string(buf);
// return buf2string(buf);
// Chrome prefers to work with "small" chunks of data
// for the method buf2string.
// Firefox and Chrome has their own shortcut, IE doesn't seem to really care.
var result = [],
len = buf.length,
chunk = 65536;
len = buf.length,
chunk = 65536;
var k = 0;
while (k < len) {
var nextBoundary = utf8border(buf, Math.min(k + chunk, len));
if (support.uint8array) {

@@ -252,7 +233,5 @@ result.push(buf2string(buf.subarray(k, nextBoundary)));

}
k = nextBoundary;
}
return result.join("");
};
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
var support = require("./support.js");
var compressions = require("./compressions.js");
var nodeBuffer = require("./nodeBuffer.js");

@@ -15,18 +12,12 @@ /**

*/
exports.string2binary = function (str) {
var result = "";
for (var i = 0; i < str.length; i++) {
result += String.fromCharCode(str.charCodeAt(i) & 0xff);
}
return result;
};
exports.arrayBuffer2Blob = function (buffer, mimeType) {
exports.checkSupport("blob");
mimeType = mimeType || "application/zip";
try {

@@ -55,7 +46,6 @@ // Blob constructor

*/
function identity(input) {
return input;
}
/**

@@ -67,4 +57,2 @@ * Fill in an array with a string.

*/
function stringToArrayLike(str, array) {

@@ -74,5 +62,5 @@ for (var i = 0; i < str.length; ++i) {

}
return array;
}
/**

@@ -83,4 +71,2 @@ * Transform an array-like object to a string.

*/
function arrayLikeToString(array) {

@@ -98,7 +84,6 @@ // Performances notes :

var result = [],
len = array.length,
type = exports.getTypeOf(array);
len = array.length,
type = exports.getTypeOf(array);
var k = 0,
canUseApply = true;
canUseApply = true;
try {

@@ -109,3 +94,2 @@ switch (type) {

break;
case "nodebuffer":

@@ -117,16 +101,13 @@ String.fromCharCode.apply(null, nodeBuffer(0));

canUseApply = false;
} // no apply : slow and painful algorithm
}
// no apply : slow and painful algorithm
// default browser on android 4.*
if (!canUseApply) {
var resultStr = "";
for (var i = 0; i < array.length; i++) {
resultStr += String.fromCharCode(array[i]);
}
return resultStr;
}
while (k < len && chunk > 1) {

@@ -139,3 +120,2 @@ try {

}
k += chunk;

@@ -146,7 +126,6 @@ } catch (e) {

}
return result.join("");
}
exports.applyFromCharCode = arrayLikeToString;
exports.applyFromCharCode = arrayLikeToString;
/**

@@ -158,3 +137,2 @@ * Copy the data from an array-like to an other array-like.

*/
function arrayLikeToArrayLike(arrayFrom, arrayTo) {

@@ -164,9 +142,9 @@ for (var i = 0; i < arrayFrom.length; i++) {

}
return arrayTo;
} // a matrix containing functions to transform everything into everything.
}
// a matrix containing functions to transform everything into everything.
var transform = {};
var transform = {}; // string to ?
// string to ?
transform.string = {

@@ -186,4 +164,5 @@ string: identity,

}
}; // array to ?
};
// array to ?
transform.array = {

@@ -201,4 +180,5 @@ string: arrayLikeToString,

}
}; // arraybuffer to ?
};
// arraybuffer to ?
transform.arraybuffer = {

@@ -218,4 +198,5 @@ string: function string(input) {

}
}; // uint8array to ?
};
// uint8array to ?
transform.uint8array = {

@@ -233,4 +214,5 @@ string: arrayLikeToString,

}
}; // nodebuffer to ?
};
// nodebuffer to ?
transform.nodebuffer = {

@@ -249,2 +231,3 @@ string: arrayLikeToString,

};
/**

@@ -258,3 +241,2 @@ * Transform an input into any type.

*/
exports.transformTo = function (outputType, input) {

@@ -266,7 +248,5 @@ if (!input) {

}
if (!outputType) {
return input;
}
exports.checkSupport(outputType);

@@ -277,2 +257,3 @@ var inputType = exports.getTypeOf(input);

};
/**

@@ -284,4 +265,2 @@ * Return the type of the input.

*/
exports.getTypeOf = function (input) {

@@ -291,35 +270,26 @@ if (input == null) {

}
if (typeof input === "string") {
return "string";
}
if (Object.prototype.toString.call(input) === "[object Array]") {
return "array";
}
if (support.nodebuffer && nodeBuffer.test(input)) {
return "nodebuffer";
}
if (support.uint8array && input instanceof Uint8Array) {
return "uint8array";
}
if (support.arraybuffer && input instanceof ArrayBuffer) {
return "arraybuffer";
}
if (input instanceof Promise) {
throw new Error("Cannot read data from a promise, you probably are running new PizZip(data) with a promise");
}
if (_typeof(input) === "object" && typeof input.file === "function") {
throw new Error("Cannot read data from a pizzip instance, you probably are running new PizZip(zip) with a zipinstance");
}
if (input instanceof Date) {
throw new Error("Cannot read data from a Date, you probably are running new PizZip(data) with a date");
}
if (_typeof(input) === "object" && input.crc32 == null) {

@@ -329,2 +299,3 @@ throw new Error("Unsupported data given to new PizZip(data) (object given)");

};
/**

@@ -335,7 +306,4 @@ * Throw an exception if the type is not supported.

*/
exports.checkSupport = function (type) {
var supported = support[type.toLowerCase()];
if (!supported) {

@@ -345,3 +313,2 @@ throw new Error(type + " is not supported by this browser");

};
exports.MAX_VALUE_16BITS = 65535;

@@ -355,8 +322,6 @@ exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1

*/
exports.pretty = function (str) {
var res = "",
code,
i;
code,
i;
for (i = 0; i < (str || "").length; i++) {

@@ -366,5 +331,5 @@ code = str.charCodeAt(i);

}
return res;
};
/**

@@ -375,4 +340,2 @@ * Find a compression registered in PizZip.

*/
exports.findCompression = function (compressionMethod) {

@@ -383,3 +346,2 @@ for (var method in compressions) {

}
if (compressions[method].magic === compressionMethod) {

@@ -389,3 +351,2 @@ return compressions[method];

}
return null;

@@ -399,7 +360,6 @@ };

*/
exports.isRegExp = function (object) {
return Object.prototype.toString.call(object) === "[object RegExp]";
};
/**

@@ -411,8 +371,5 @@ * Merge the objects passed as parameters into a new one.

*/
exports.extend = function () {
var result = {};
var i, attr;
for (i = 0; i < arguments.length; i++) {

@@ -426,4 +383,3 @@ // arguments is not enumerable in some browsers

}
return result;
};
"use strict";
var StringReader = require("./stringReader.js");
var NodeBufferReader = require("./nodeBufferReader.js");
var Uint8ArrayReader = require("./uint8ArrayReader.js");
var ArrayReader = require("./arrayReader.js");
var utils = require("./utils.js");
var sig = require("./signature.js");
var ZipEntry = require("./zipEntry.js");
var support = require("./support.js"); // class ZipEntries {{{
var support = require("./support.js");
// class ZipEntries {{{
/**

@@ -25,8 +18,5 @@ * All the entries in the zip file.

*/
function ZipEntries(data, loadOptions) {
this.files = [];
this.loadOptions = loadOptions;
if (data) {

@@ -36,3 +26,2 @@ this.load(data);

}
ZipEntries.prototype = {

@@ -46,3 +35,2 @@ /**

var signature = this.reader.readString(4);
if (signature !== expectedSignature) {

@@ -52,3 +40,2 @@ throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");

},
/**

@@ -68,3 +55,2 @@ * Check if the given signature is at the given index.

},
/**

@@ -80,14 +66,13 @@ * Read the end of the central directory.

this.centralDirOffset = this.reader.readInt(4);
this.zipCommentLength = this.reader.readInt(2); // warning : the encoding depends of the system locale
this.zipCommentLength = this.reader.readInt(2);
// warning : the encoding depends of the system locale
// On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.
// On a windows machine, this field is encoded with the localized windows code page.
var zipComment = this.reader.readData(this.zipCommentLength);
var decodeParamType = support.uint8array ? "uint8array" : "array"; // To get consistent behavior with the generation part, we will assume that
var decodeParamType = support.uint8array ? "uint8array" : "array";
// To get consistent behavior with the generation part, we will assume that
// this is utf8 encoded unless specified otherwise.
var decodeContent = utils.transformTo(decodeParamType, zipComment);
this.zipComment = this.loadOptions.decodeFileName(decodeContent);
},
/**

@@ -113,3 +98,2 @@ * Read the end of the Zip 64 central directory.

var extraFieldId, extraFieldLength, extraFieldValue;
while (index < extraDataSize) {

@@ -126,3 +110,2 @@ extraFieldId = this.reader.readInt(2);

},
/**

@@ -135,3 +118,2 @@ * Read the end of the Zip 64 central directory locator.

this.disksCount = this.reader.readInt(4);
if (this.disksCount > 1) {

@@ -141,3 +123,2 @@ throw new Error("Multi-volumes zip are not supported");

},
/**

@@ -148,3 +129,2 @@ * Read the local files, based on the offset read in the central part.

var i, file;
for (i = 0; i < this.files.length; i++) {

@@ -159,3 +139,2 @@ file = this.files[i];

},
/**

@@ -167,3 +146,2 @@ * Read the central directory.

this.reader.setIndex(this.centralDirOffset);
while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) {

@@ -176,3 +154,2 @@ file = new ZipEntry({

}
if (this.centralDirRecords !== this.files.length) {

@@ -183,3 +160,4 @@ if (this.centralDirRecords !== 0 && this.files.length === 0) {

throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
} else {// We found some records but not all.
} else {
// We found some records but not all.
// Something is wrong but we got something for the user: no error here.

@@ -190,3 +168,2 @@ // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length);

},
/**

@@ -197,3 +174,2 @@ * Read the end of central directory.

var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
if (offset < 0) {

@@ -206,3 +182,2 @@ // Check if the content is a truncated zip or complete garbage.

var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);
if (isGarbage) {

@@ -214,3 +189,2 @@ throw new Error("Can't find end of central directory : is this a zip file ?");

}
this.reader.setIndex(offset);

@@ -220,2 +194,3 @@ var endOfCentralDirOffset = offset;

this.readBlockEndOfCentral();
/* extract from the zip spec :

@@ -231,5 +206,5 @@ 4) If one of the fields in the end of central directory

*/
if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
this.zip64 = true;
/*

@@ -243,18 +218,16 @@ Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from

*/
// should look for a zip64 EOCD locator
offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
if (offset < 0) {
throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");
}
this.reader.setIndex(offset);
this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record
this.readBlockZip64EndOfCentralLocator();
// now the zip64 EOCD record
if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {
// console.warn("ZIP64 end of central directory not where expected.");
this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
if (this.relativeOffsetEndOfZip64CentralDir < 0) {

@@ -264,3 +237,2 @@ throw new Error("Corrupted zip : can't find the ZIP64 end of central directory");

}
this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);

@@ -270,18 +242,12 @@ this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);

}
var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;
if (this.zip64) {
expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator
expectedEndOfCentralDirOffset += 12
/* should not include the leading 12 bytes */
+ this.zip64EndOfCentralSize;
expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;
}
var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;
if (extraBytes > 0) {
// console.warn(extraBytes, "extra bytes at beginning or within zipfile");
if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {// The offsets seem wrong, but we have something at the specified offset.
if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {
// The offsets seem wrong, but we have something at the specified offset.
// So… we keep it.

@@ -300,3 +266,2 @@ } else {

utils.checkSupport(type);
if (type === "string" && !support.uint8array) {

@@ -314,3 +279,2 @@ this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString);

},
/**

@@ -326,4 +290,4 @@ * Read a zip file and create ZipEntries.

}
}; // }}} end of ZipEntries
};
// }}} end of ZipEntries
module.exports = ZipEntries;
"use strict";
var StringReader = require("./stringReader.js");
var utils = require("./utils.js");
var CompressedObject = require("./compressedObject.js");
var pizzipProto = require("./object.js");
var support = require("./support.js");
var MADE_BY_DOS = 0x00;
var MADE_BY_UNIX = 0x03; // class ZipEntry {{{
var MADE_BY_UNIX = 0x03;
// class ZipEntry {{{
/**

@@ -22,3 +18,2 @@ * An entry in the zip file.

*/
function ZipEntry(options, loadOptions) {

@@ -28,3 +23,2 @@ this.options = options;

}
ZipEntry.prototype = {

@@ -39,3 +33,2 @@ /**

},
/**

@@ -49,3 +42,2 @@ * say if the file has utf-8 filename/comment.

},
/**

@@ -67,3 +59,2 @@ * Prepare the function used to generate the compressed content from this ZipFile.

},
/**

@@ -82,11 +73,8 @@ * Prepare the function used to generate the uncompressed content from this ZipFile.

var uncompressedFileData = compression.uncompress(compressedFileData);
if (uncompressedFileData.length !== uncompressedSize) {
throw new Error("Bug : uncompressed data size mismatch");
}
return uncompressedFileData;
};
},
/**

@@ -102,3 +90,4 @@ * Read the local part of a zip file and add the info in this object.

// Let's skip the whole header and dash to the data !
reader.skip(22); // in some zip created on windows, the filename stored in the central dir contains \ instead of /.
reader.skip(22);
// in some zip created on windows, the filename stored in the central dir contains \ instead of /.
// Strangely, the filename here is OK.

@@ -114,15 +103,10 @@ // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes

// Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394
this.fileNameLength = reader.readInt(2);
var localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir
this.fileName = reader.readData(this.fileNameLength);
reader.skip(localExtraFieldsLength);
if (this.compressedSize === -1 || this.uncompressedSize === -1) {
throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)");
}
var compression = utils.findCompression(this.compressionMethod);
if (compression === null) {

@@ -132,3 +116,2 @@ // no compression found

}
this.decompressed = new CompressedObject();

@@ -140,7 +123,7 @@ this.decompressed.compressedSize = this.compressedSize;

this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression);
this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); // we need to compute the crc32...
this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize);
// we need to compute the crc32...
if (this.loadOptions.checkCRC32) {
this.decompressed = utils.transformTo("string", this.decompressed.getContent());
if (pizzipProto.crc32(this.decompressed) !== this.crc32) {

@@ -151,3 +134,2 @@ throw new Error("Corrupted zip : CRC32 mismatch");

},
/**

@@ -173,7 +155,5 @@ * Read the central part of a zip file and add the info in this object.

this.localHeaderOffset = reader.readInt(4);
if (this.isEncrypted()) {
throw new Error("Encrypted zip are not supported");
}
this.fileName = reader.readData(this.fileNameLength);

@@ -184,3 +164,2 @@ this.readExtraFields(reader);

},
/**

@@ -192,8 +171,8 @@ * Parse the external file attributes and get the unix/dos permissions.

this.dosPermissions = null;
var madeBy = this.versionMadeBy >> 8; // Check if we have the DOS directory flag set.
var madeBy = this.versionMadeBy >> 8;
// Check if we have the DOS directory flag set.
// We look for it in the DOS and UNIX permissions
// but some unknown platform could set it as a compatibility flag.
this.dir = !!(this.externalFileAttributes & 0x0010);
if (madeBy === MADE_BY_DOS) {

@@ -203,8 +182,8 @@ // first 6 bits (0 to 5)

}
if (madeBy === MADE_BY_UNIX) {
this.unixPermissions = this.externalFileAttributes >> 16 & 0xffff; // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);
} // fail safe : if the name ends with a / it probably means a folder
this.unixPermissions = this.externalFileAttributes >> 16 & 0xffff;
// the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);
}
// fail safe : if the name ends with a / it probably means a folder
if (!this.dir && this.fileNameStr.slice(-1) === "/") {

@@ -214,3 +193,2 @@ this.dir = true;

},
/**

@@ -222,20 +200,18 @@ * Parse the ZIP64 extra field and merge the info in the current ZipEntry.

return;
} // should be something, preparing the extra reader
}
// should be something, preparing the extra reader
var extraReader = new StringReader(this.extraFields[0x0001].value);
var extraReader = new StringReader(this.extraFields[0x0001].value); // I really hope that these 64bits integer can fit in 32 bits integer, because js
// I really hope that these 64bits integer can fit in 32 bits integer, because js
// won't let us have more.
if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {
this.uncompressedSize = extraReader.readInt(8);
}
if (this.compressedSize === utils.MAX_VALUE_32BITS) {
this.compressedSize = extraReader.readInt(8);
}
if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {
this.localHeaderOffset = extraReader.readInt(8);
}
if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {

@@ -245,3 +221,2 @@ this.diskNumberStart = extraReader.readInt(4);

},
/**

@@ -255,3 +230,2 @@ * Read the central part of a zip file and add the info in this object.

this.extraFields = this.extraFields || {};
while (reader.index < start + this.extraFieldsLength) {

@@ -268,3 +242,2 @@ extraFieldId = reader.readInt(2);

},
/**

@@ -275,3 +248,2 @@ * Apply an UTF8 transformation if needed.

var decodeParamType = support.uint8array ? "uint8array" : "array";
if (this.useUTF8()) {

@@ -282,3 +254,2 @@ this.fileNameStr = pizzipProto.utf8decode(this.fileName);

var upath = this.findExtraFieldUnicodePath();
if (upath !== null) {

@@ -290,5 +261,3 @@ this.fileNameStr = upath;

}
var ucomment = this.findExtraFieldUnicodeComment();
if (ucomment !== null) {

@@ -302,3 +271,2 @@ this.fileCommentStr = ucomment;

},
/**

@@ -310,21 +278,18 @@ * Find the unicode path declared in the extra field, if any.

var upathField = this.extraFields[0x7075];
if (upathField) {
var extraReader = new StringReader(upathField.value); // wrong version
var extraReader = new StringReader(upathField.value);
// wrong version
if (extraReader.readInt(1) !== 1) {
return null;
} // the crc of the filename changed, this field is out of date.
}
// the crc of the filename changed, this field is out of date.
if (pizzipProto.crc32(this.fileName) !== extraReader.readInt(4)) {
return null;
}
return pizzipProto.utf8decode(extraReader.readString(upathField.length - 5));
}
return null;
},
/**

@@ -336,18 +301,16 @@ * Find the unicode comment declared in the extra field, if any.

var ucommentField = this.extraFields[0x6375];
if (ucommentField) {
var extraReader = new StringReader(ucommentField.value); // wrong version
var extraReader = new StringReader(ucommentField.value);
// wrong version
if (extraReader.readInt(1) !== 1) {
return null;
} // the crc of the comment changed, this field is out of date.
}
// the crc of the comment changed, this field is out of date.
if (pizzipProto.crc32(this.fileComment) !== extraReader.readInt(4)) {
return null;
}
return pizzipProto.utf8decode(extraReader.readString(ucommentField.length - 5));
}
return null;

@@ -354,0 +317,0 @@ }

{
"name": "pizzip",
"version": "3.1.3",
"version": "3.1.4",
"author": "Edgar Hipp",

@@ -52,24 +52,24 @@ "description": "Create, read and edit .zip files synchronously with Javascript",

"devDependencies": {
"tsd": "^0.24.1",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.19.1",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/preset-env": "^7.19.1",
"acorn": "^8.8.0",
"babel-loader": "^8.2.5",
"chai": "^4.3.6",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.5",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"acorn": "^8.8.1",
"babel-loader": "^9.1.0",
"chai": "^4.3.7",
"cross-env": "^7.0.3",
"eslint": "^8.23.1",
"eslint_d": "^12.2.0",
"eslint": "^8.29.0",
"eslint_d": "^12.2.1",
"eslint-plugin-import": "^2.26.0",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"mocha": "^10.2.0",
"prettier": "^2.8.1",
"tsd": "^0.25.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@babel/eslint-parser": "^7.19.1",
"pako": "^2.0.4"
"pako": "^2.1.0"
},
"license": "(MIT OR GPL-3.0)"
}

@@ -19,3 +19,3 @@ /*

eval("/* global IEBinaryToArray_ByteStr, IEBinaryToArray_ByteStr_Last */\n // Adapted from http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest\n\nvar IEBinaryToArray_ByteStr_Script = \"<!-- IEBinaryToArray_ByteStr -->\\r\\n\" + \"<script type='text/vbscript'>\\r\\n\" + \"Function IEBinaryToArray_ByteStr(Binary)\\r\\n\" + \" IEBinaryToArray_ByteStr = CStr(Binary)\\r\\n\" + \"End Function\\r\\n\" + \"Function IEBinaryToArray_ByteStr_Last(Binary)\\r\\n\" + \" Dim lastIndex\\r\\n\" + \" lastIndex = LenB(Binary)\\r\\n\" + \" if lastIndex mod 2 Then\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\\r\\n\" + \" Else\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = \" + '\"\"' + \"\\r\\n\" + \" End If\\r\\n\" + \"End Function\\r\\n\" + \"</script>\\r\\n\"; // inject VBScript\n\ndocument.write(IEBinaryToArray_ByteStr_Script);\n\n__webpack_require__.g.PizZipUtils._getBinaryFromXHR = function (xhr) {\n var binary = xhr.responseBody;\n var byteMapping = {};\n\n for (var i = 0; i < 256; i++) {\n for (var j = 0; j < 256; j++) {\n byteMapping[String.fromCharCode(i + (j << 8))] = String.fromCharCode(i) + String.fromCharCode(j);\n }\n }\n\n var rawBytes = IEBinaryToArray_ByteStr(binary);\n var lastChr = IEBinaryToArray_ByteStr_Last(binary);\n return rawBytes.replace(/[\\s\\S]/g, function (match) {\n return byteMapping[match];\n }) + lastChr;\n};\n\n//# sourceURL=webpack:///./es6/index_IE.js?");
eval("/* global IEBinaryToArray_ByteStr, IEBinaryToArray_ByteStr_Last */\n\n\n// Adapted from http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest\nvar IEBinaryToArray_ByteStr_Script = \"<!-- IEBinaryToArray_ByteStr -->\\r\\n\" + \"<script type='text/vbscript'>\\r\\n\" + \"Function IEBinaryToArray_ByteStr(Binary)\\r\\n\" + \" IEBinaryToArray_ByteStr = CStr(Binary)\\r\\n\" + \"End Function\\r\\n\" + \"Function IEBinaryToArray_ByteStr_Last(Binary)\\r\\n\" + \" Dim lastIndex\\r\\n\" + \" lastIndex = LenB(Binary)\\r\\n\" + \" if lastIndex mod 2 Then\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\\r\\n\" + \" Else\\r\\n\" + \" IEBinaryToArray_ByteStr_Last = \" + '\"\"' + \"\\r\\n\" + \" End If\\r\\n\" + \"End Function\\r\\n\" + \"</script>\\r\\n\";\n\n// inject VBScript\ndocument.write(IEBinaryToArray_ByteStr_Script);\n__webpack_require__.g.PizZipUtils._getBinaryFromXHR = function (xhr) {\n var binary = xhr.responseBody;\n var byteMapping = {};\n for (var i = 0; i < 256; i++) {\n for (var j = 0; j < 256; j++) {\n byteMapping[String.fromCharCode(i + (j << 8))] = String.fromCharCode(i) + String.fromCharCode(j);\n }\n }\n var rawBytes = IEBinaryToArray_ByteStr(binary);\n var lastChr = IEBinaryToArray_ByteStr_Last(binary);\n return rawBytes.replace(/[\\s\\S]/g, function (match) {\n return byteMapping[match];\n }) + lastChr;\n};\n\n//# sourceURL=webpack:///./es6/index_IE.js?");

@@ -22,0 +22,0 @@ /***/ })

@@ -19,3 +19,3 @@ /*

eval("\n\nvar PizZipUtils = {}; // just use the responseText with xhr1, response with xhr2.\n// The transformation doesn't throw away high-order byte (with responseText)\n// because PizZip handles that case. If not used with PizZip, you may need to\n// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n\nPizZipUtils._getBinaryFromXHR = function (xhr) {\n // for xhr.responseText, the 0xFF mask is applied by PizZip\n return xhr.response || xhr.responseText;\n}; // taken from jQuery\n\n\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n}\n\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (e) {}\n} // Create the request object\n\n\nvar createXHR = window.ActiveXObject ?\n/* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\nfunction () {\n return createStandardXHR() || createActiveXHR();\n} : // For all other browsers, use the standard XMLHttpRequest object\ncreateStandardXHR;\n\nPizZipUtils.getBinaryContent = function (path, callback) {\n /*\n * Here is the tricky part : getting the data.\n * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'\n * is enough, the result is in the standard xhr.responseText.\n * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers\n * In IE <= 9, we must use (the IE only) attribute responseBody\n * (for binary data, its content is different from responseText).\n * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the\n * responseType will work :\n * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download\n *\n * I'd like to use jQuery to avoid this XHR madness, but it doesn't support\n * the responseType attribute : http://bugs.jquery.com/ticket/11461\n */\n try {\n var xhr = createXHR();\n xhr.open(\"GET\", path, true); // recent browsers\n\n if (\"responseType\" in xhr) {\n xhr.responseType = \"arraybuffer\";\n } // older browser\n\n\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\n }\n\n xhr.onreadystatechange = function (evt) {\n var file, err; // use `xhr` and not `this`... thanks IE\n\n if (xhr.readyState === 4) {\n if (xhr.status === 200 || xhr.status === 0) {\n file = null;\n err = null;\n\n try {\n file = PizZipUtils._getBinaryFromXHR(xhr);\n } catch (e) {\n err = new Error(e);\n }\n\n callback(err, file);\n } else {\n callback(new Error(\"Ajax error for \" + path + \" : \" + this.status + \" \" + this.statusText), null);\n }\n }\n };\n\n xhr.send();\n } catch (e) {\n callback(new Error(e), null);\n }\n};\n\nmodule.exports = PizZipUtils;\n\n//# sourceURL=webpack://PizZipUtils/./es6/index.js?");
eval("\n\nvar PizZipUtils = {};\n// just use the responseText with xhr1, response with xhr2.\n// The transformation doesn't throw away high-order byte (with responseText)\n// because PizZip handles that case. If not used with PizZip, you may need to\n// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\nPizZipUtils._getBinaryFromXHR = function (xhr) {\n // for xhr.responseText, the 0xFF mask is applied by PizZip\n return xhr.response || xhr.responseText;\n};\n\n// taken from jQuery\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n}\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (e) {}\n}\n\n// Create the request object\nvar createXHR = window.ActiveXObject ?\n/* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\nfunction () {\n return createStandardXHR() || createActiveXHR();\n} :\n// For all other browsers, use the standard XMLHttpRequest object\ncreateStandardXHR;\nPizZipUtils.getBinaryContent = function (path, callback) {\n /*\n * Here is the tricky part : getting the data.\n * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'\n * is enough, the result is in the standard xhr.responseText.\n * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers\n * In IE <= 9, we must use (the IE only) attribute responseBody\n * (for binary data, its content is different from responseText).\n * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the\n * responseType will work :\n * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download\n *\n * I'd like to use jQuery to avoid this XHR madness, but it doesn't support\n * the responseType attribute : http://bugs.jquery.com/ticket/11461\n */\n try {\n var xhr = createXHR();\n xhr.open(\"GET\", path, true);\n\n // recent browsers\n if (\"responseType\" in xhr) {\n xhr.responseType = \"arraybuffer\";\n }\n\n // older browser\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\n }\n xhr.onreadystatechange = function (evt) {\n var file, err;\n // use `xhr` and not `this`... thanks IE\n if (xhr.readyState === 4) {\n if (xhr.status === 200 || xhr.status === 0) {\n file = null;\n err = null;\n try {\n file = PizZipUtils._getBinaryFromXHR(xhr);\n } catch (e) {\n err = new Error(e);\n }\n callback(err, file);\n } else {\n callback(new Error(\"Ajax error for \" + path + \" : \" + this.status + \" \" + this.statusText), null);\n }\n }\n };\n xhr.send();\n } catch (e) {\n callback(new Error(e), null);\n }\n};\nmodule.exports = PizZipUtils;\n\n//# sourceURL=webpack://PizZipUtils/./es6/index.js?");

@@ -22,0 +22,0 @@ /***/ })

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

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

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