aboutsummaryrefslogtreecommitdiff
path: root/node_modules/adm-zip
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-16 01:59:39 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-16 02:00:31 +0100
commitbd65bb67e25a79b019d745b7262b2008ce2adb15 (patch)
tree89e1b032103a63737f1a703e6a943832ef261704 /node_modules/adm-zip
parentf91466595b651721690133f58ab37f977539e95b (diff)
incrementally verify denoms
The denominations are not stored in a separate object store.
Diffstat (limited to 'node_modules/adm-zip')
-rw-r--r--node_modules/adm-zip/.idea/scopes/scope_settings.xml5
-rw-r--r--node_modules/adm-zip/MIT-LICENSE.txt21
-rw-r--r--node_modules/adm-zip/adm-zip.js93
-rw-r--r--node_modules/adm-zip/package.json10
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test.zipbin4189 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/New folder/hidden.txt17
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/New folder/hidden_readonly.txt17
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/New folder/readonly.txt17
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/New folder/somefile.txt17
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/asd/New Text Document.txt0
-rw-r--r--node_modules/adm-zip/test/assets/attributes_test/blank file.txt0
-rw-r--r--node_modules/adm-zip/test/assets/fast.zipbin4194 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/fastest.zipbin4194 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/linux_arc.zipbin415 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/maximum.zipbin4086 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/normal.zipbin4170 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/store.zipbin5878 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/assets/ultra.zipbin4086 -> 0 bytes
-rw-r--r--node_modules/adm-zip/test/index.js5
-rw-r--r--node_modules/adm-zip/util/constants.js33
-rw-r--r--node_modules/adm-zip/util/utils.js58
-rw-r--r--node_modules/adm-zip/zipEntry.js72
-rw-r--r--node_modules/adm-zip/zipFile.js4
23 files changed, 247 insertions, 122 deletions
diff --git a/node_modules/adm-zip/.idea/scopes/scope_settings.xml b/node_modules/adm-zip/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 0d5175ca0..000000000
--- a/node_modules/adm-zip/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<component name="DependencyValidationManager">
- <state>
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
- </state>
-</component> \ No newline at end of file
diff --git a/node_modules/adm-zip/MIT-LICENSE.txt b/node_modules/adm-zip/MIT-LICENSE.txt
deleted file mode 100644
index 14c3ee5cf..000000000
--- a/node_modules/adm-zip/MIT-LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2012 Another-D-Mention Software and other contributors,
-http://www.another-d-mention.ro/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/adm-zip/adm-zip.js b/node_modules/adm-zip/adm-zip.js
index 46595fc5d..26736bb02 100644
--- a/node_modules/adm-zip/adm-zip.js
+++ b/node_modules/adm-zip/adm-zip.js
@@ -186,7 +186,7 @@ module.exports = function(/*String*/input) {
*
* @param localPath
*/
- addLocalFile : function(/*String*/localPath, /*String*/zipPath) {
+ addLocalFile : function(/*String*/localPath, /*String*/zipPath, /*String*/zipName) {
if (fs.existsSync(localPath)) {
if(zipPath){
zipPath=zipPath.split("\\").join("/");
@@ -197,8 +197,12 @@ module.exports = function(/*String*/input) {
zipPath="";
}
var p = localPath.split("\\").join("/").split("/").pop();
-
- this.addFile(zipPath+p, fs.readFileSync(localPath), "", 0)
+
+ if(zipName){
+ this.addFile(zipPath+zipName, fs.readFileSync(localPath), "", 0)
+ }else{
+ this.addFile(zipPath+p, fs.readFileSync(localPath), "", 0)
+ }
} else {
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath);
}
@@ -208,8 +212,21 @@ module.exports = function(/*String*/input) {
* Adds a local directory and all its nested files and directories to the archive
*
* @param localPath
+ * @param zipPath optional path inside zip
+ * @param filter optional RegExp or Function if files match will
+ * be included.
*/
- addLocalFolder : function(/*String*/localPath, /*String*/zipPath) {
+ addLocalFolder : function(/*String*/localPath, /*String*/zipPath, /*RegExp|Function*/filter) {
+ if (filter === undefined) {
+ filter = function() { return true; };
+ } else if (filter instanceof RegExp) {
+ filter = function(filter) {
+ return function(filename) {
+ return filter.test(filename);
+ }
+ }(filter);
+ }
+
if(zipPath){
zipPath=zipPath.split("\\").join("/");
if(zipPath.charAt(zipPath.length - 1) != "/"){
@@ -219,6 +236,7 @@ module.exports = function(/*String*/input) {
zipPath="";
}
localPath = localPath.split("\\").join("/"); //windows fix
+ localPath = pth.normalize(localPath);
if (localPath.charAt(localPath.length - 1) != "/")
localPath += "/";
@@ -229,11 +247,13 @@ module.exports = function(/*String*/input) {
if (items.length) {
items.forEach(function(path) {
- var p = path.split("\\").join("/").replace(localPath, ""); //windows fix
- if (p.charAt(p.length - 1) !== "/") {
- self.addFile(zipPath+p, fs.readFileSync(path), "", 0)
- } else {
- self.addFile(zipPath+p, new Buffer(0), "", 0)
+ var p = path.split("\\").join("/").replace( new RegExp(localPath, 'i'), ""); //windows fix
+ if (filter(p)) {
+ if (p.charAt(p.length - 1) !== "/") {
+ self.addFile(zipPath+p, fs.readFileSync(path), "", 0)
+ } else {
+ self.addFile(zipPath+p, new Buffer(0), "", 0)
+ }
}
});
}
@@ -328,7 +348,7 @@ module.exports = function(/*String*/input) {
var content = item.getData();
if (!content) throw Utils.Errors.CANT_EXTRACT_FILE;
- if (fs.existsSync(targetPath) && !overwrite) {
+ if (fs.existsSync(target) && !overwrite) {
throw Utils.Errors.CANT_OVERRIDE;
}
Utils.writeFileTo(target, content, overwrite);
@@ -363,6 +383,56 @@ module.exports = function(/*String*/input) {
},
/**
+ * Asynchronous extractAllTo
+ *
+ * @param targetPath Target location
+ * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
+ * Default is FALSE
+ * @param callback
+ */
+ extractAllToAsync : function(/*String*/targetPath, /*Boolean*/overwrite, /*Function*/callback) {
+ overwrite = overwrite || false;
+ if (!_zip) {
+ callback(new Error(Utils.Errors.NO_ZIP));
+ return;
+ }
+
+ var entries = _zip.entries;
+ var i = entries.length;
+ entries.forEach(function(entry) {
+ if(i <= 0) return; // Had an error already
+
+ if (entry.isDirectory) {
+ Utils.makeDir(pth.resolve(targetPath, entry.entryName.toString()));
+ if(--i == 0)
+ callback(undefined);
+ return;
+ }
+ entry.getDataAsync(function(content) {
+ if(i <= 0) return;
+ if (!content) {
+ i = 0;
+ callback(new Error(Utils.Errors.CANT_EXTRACT_FILE + "2"));
+ return;
+ }
+ Utils.writeFileToAsync(pth.resolve(targetPath, entry.entryName.toString()), content, overwrite, function(succ) {
+ if(i <= 0) return;
+
+ if(!succ) {
+ i = 0;
+ callback(new Error('Unable to write'));
+ return;
+ }
+
+ if(--i == 0)
+ callback(undefined);
+ });
+
+ });
+ })
+ },
+
+ /**
* Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip
*
* @param targetFileName
@@ -383,7 +453,8 @@ module.exports = function(/*String*/input) {
var zipData = _zip.compressToBuffer();
if (zipData) {
- Utils.writeFileTo(targetFileName, zipData, true);
+ var ok = Utils.writeFileTo(targetFileName, zipData, true);
+ if (typeof callback == 'function') callback(!ok? new Error("failed"): null, "");
}
},
diff --git a/node_modules/adm-zip/package.json b/node_modules/adm-zip/package.json
index e068ba012..6fda456e1 100644
--- a/node_modules/adm-zip/package.json
+++ b/node_modules/adm-zip/package.json
@@ -1,6 +1,6 @@
{
"name": "adm-zip",
- "version": "0.4.4",
+ "version": "0.4.7",
"description": "A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk",
"keywords": [
"zip",
@@ -20,6 +20,14 @@
"url": "https://raw.github.com/cthackers/adm-zip/master/MIT-LICENSE.txt"
}
],
+ "files": [
+ "adm-zip.js",
+ "headers",
+ "methods",
+ "util",
+ "zipEntry.js",
+ "zipFile.js"
+ ],
"main": "adm-zip.js",
"repository": {
"type": "git",
diff --git a/node_modules/adm-zip/test/assets/attributes_test.zip b/node_modules/adm-zip/test/assets/attributes_test.zip
deleted file mode 100644
index d57bfc075..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden.txt b/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden.txt
deleted file mode 100644
index 3c3ca551d..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden_readonly.txt b/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden_readonly.txt
deleted file mode 100644
index 3c3ca551d..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/New folder/hidden_readonly.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/adm-zip/test/assets/attributes_test/New folder/readonly.txt b/node_modules/adm-zip/test/assets/attributes_test/New folder/readonly.txt
deleted file mode 100644
index 3c3ca551d..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/New folder/readonly.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/adm-zip/test/assets/attributes_test/New folder/somefile.txt b/node_modules/adm-zip/test/assets/attributes_test/New folder/somefile.txt
deleted file mode 100644
index 3c3ca551d..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/New folder/somefile.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/adm-zip/test/assets/attributes_test/asd/New Text Document.txt b/node_modules/adm-zip/test/assets/attributes_test/asd/New Text Document.txt
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/asd/New Text Document.txt
+++ /dev/null
diff --git a/node_modules/adm-zip/test/assets/attributes_test/blank file.txt b/node_modules/adm-zip/test/assets/attributes_test/blank file.txt
deleted file mode 100644
index e69de29bb..000000000
--- a/node_modules/adm-zip/test/assets/attributes_test/blank file.txt
+++ /dev/null
diff --git a/node_modules/adm-zip/test/assets/fast.zip b/node_modules/adm-zip/test/assets/fast.zip
deleted file mode 100644
index f4ed17b98..000000000
--- a/node_modules/adm-zip/test/assets/fast.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/fastest.zip b/node_modules/adm-zip/test/assets/fastest.zip
deleted file mode 100644
index f4ed17b98..000000000
--- a/node_modules/adm-zip/test/assets/fastest.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/linux_arc.zip b/node_modules/adm-zip/test/assets/linux_arc.zip
deleted file mode 100644
index 188eccbe8..000000000
--- a/node_modules/adm-zip/test/assets/linux_arc.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/maximum.zip b/node_modules/adm-zip/test/assets/maximum.zip
deleted file mode 100644
index 86a8ec776..000000000
--- a/node_modules/adm-zip/test/assets/maximum.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/normal.zip b/node_modules/adm-zip/test/assets/normal.zip
deleted file mode 100644
index b4602c94e..000000000
--- a/node_modules/adm-zip/test/assets/normal.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/store.zip b/node_modules/adm-zip/test/assets/store.zip
deleted file mode 100644
index e2add30dc..000000000
--- a/node_modules/adm-zip/test/assets/store.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/assets/ultra.zip b/node_modules/adm-zip/test/assets/ultra.zip
deleted file mode 100644
index 86a8ec776..000000000
--- a/node_modules/adm-zip/test/assets/ultra.zip
+++ /dev/null
Binary files differ
diff --git a/node_modules/adm-zip/test/index.js b/node_modules/adm-zip/test/index.js
deleted file mode 100644
index 70acb5176..000000000
--- a/node_modules/adm-zip/test/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var Attr = require("../util").FileAttr,
- Zip = require("../adm-zip"),
- fs = require("fs");
-
-//zip.addLocalFile("./test/readonly.txt");
diff --git a/node_modules/adm-zip/util/constants.js b/node_modules/adm-zip/util/constants.js
index 054805417..ea8ecb001 100644
--- a/node_modules/adm-zip/util/constants.js
+++ b/node_modules/adm-zip/util/constants.js
@@ -80,5 +80,36 @@ module.exports = {
/* Load type */
FILE : 0,
BUFFER : 1,
- NONE : 2
+ NONE : 2,
+
+ /* 4.5 Extensible data fields */
+ EF_ID : 0,
+ EF_SIZE : 2,
+
+ /* Header IDs */
+ ID_ZIP64 : 0x0001,
+ ID_AVINFO : 0x0007,
+ ID_PFS : 0x0008,
+ ID_OS2 : 0x0009,
+ ID_NTFS : 0x000a,
+ ID_OPENVMS : 0x000c,
+ ID_UNIX : 0x000d,
+ ID_FORK : 0x000e,
+ ID_PATCH : 0x000f,
+ ID_X509_PKCS7 : 0x0014,
+ ID_X509_CERTID_F : 0x0015,
+ ID_X509_CERTID_C : 0x0016,
+ ID_STRONGENC : 0x0017,
+ ID_RECORD_MGT : 0x0018,
+ ID_X509_PKCS7_RL : 0x0019,
+ ID_IBM1 : 0x0065,
+ ID_IBM2 : 0x0066,
+ ID_POSZIP : 0x4690,
+
+ EF_ZIP64_OR_32 : 0xffffffff,
+ EF_ZIP64_OR_16 : 0xffff,
+ EF_ZIP64_SUNCOMP : 0,
+ EF_ZIP64_SCOMP : 8,
+ EF_ZIP64_RHO : 16,
+ EF_ZIP64_DSN : 24
};
diff --git a/node_modules/adm-zip/util/utils.js b/node_modules/adm-zip/util/utils.js
index b14db8c1c..528109845 100644
--- a/node_modules/adm-zip/util/utils.js
+++ b/node_modules/adm-zip/util/utils.js
@@ -2,7 +2,7 @@ var fs = require("fs"),
pth = require('path');
fs.existsSync = fs.existsSync || pth.existsSync;
-
+
module.exports = (function() {
var crcTable = [],
@@ -81,7 +81,7 @@ module.exports = (function() {
case Constants.DEFLATED:
return 'DEFLATED (' + method + ')';
default:
- return 'UNSUPPORTED (' + method + ')'
+ return 'UNSUPPORTED (' + method + ')';
}
},
@@ -116,6 +116,60 @@ module.exports = (function() {
return true;
},
+ writeFileToAsync : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr, /*Function*/callback) {
+ if(typeof attr === 'function') {
+ callback = attr;
+ attr = undefined;
+ }
+
+ fs.exists(path, function(exists) {
+ if(exists && !overwrite)
+ return callback(false);
+
+ fs.stat(path, function(err, stat) {
+ if(exists &&stat.isDirectory()) {
+ return callback(false);
+ }
+
+ var folder = pth.dirname(path);
+ fs.exists(folder, function(exists) {
+ if(!exists)
+ mkdirSync(folder);
+
+ fs.open(path, 'w', 438, function(err, fd) {
+ if(err) {
+ fs.chmod(path, 438, function(err) {
+ fs.open(path, 'w', 438, function(err, fd) {
+ fs.write(fd, content, 0, content.length, 0, function(err, written, buffer) {
+ fs.close(fd, function(err) {
+ fs.chmod(path, attr || 438, function() {
+ callback(true);
+ })
+ });
+ });
+ });
+ })
+ } else {
+ if(fd) {
+ fs.write(fd, content, 0, content.length, 0, function(err, written, buffer) {
+ fs.close(fd, function(err) {
+ fs.chmod(path, attr || 438, function() {
+ callback(true);
+ })
+ });
+ });
+ } else {
+ fs.chmod(path, attr || 438, function() {
+ callback(true);
+ })
+ }
+ }
+ });
+ })
+ })
+ })
+ },
+
findFiles : function(/*String*/path) {
return findSync(path, true);
},
diff --git a/node_modules/adm-zip/zipEntry.js b/node_modules/adm-zip/zipEntry.js
index 02c317256..03b57d69f 100644
--- a/node_modules/adm-zip/zipEntry.js
+++ b/node_modules/adm-zip/zipEntry.js
@@ -34,7 +34,11 @@ module.exports = function (/*Buffer*/input) {
return true;
}
- function decompress(/*Boolean*/async, /*Function*/callback) {
+ function decompress(/*Boolean*/async, /*Function*/callback, /*String*/pass) {
+ if(typeof callback === 'undefined' && typeof async === 'string') {
+ pass=async;
+ async=void 0;
+ }
if (_isDirectory) {
if (async && callback) {
callback(new Buffer(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.
@@ -43,6 +47,7 @@ module.exports = function (/*Buffer*/input) {
}
var compressedData = getCompressedDataFromZip();
+
if (compressedData.length == 0) {
if (async && callback) callback(compressedData, Utils.Errors.NO_DATA);//si added error.
return compressedData;
@@ -73,7 +78,7 @@ module.exports = function (/*Buffer*/input) {
} else {
inflater.inflateAsync(function(result) {
result.copy(data, 0);
- if (crc32OK(data)) {
+ if (!crc32OK(data)) {
if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error
} else { //si added otherwise did not seem to return data.
if (callback) callback(data);
@@ -136,6 +141,57 @@ module.exports = function (/*Buffer*/input) {
}
}
+ function readUInt64LE(buffer, offset) {
+ return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);
+ }
+
+ function parseExtra(data) {
+ var offset = 0;
+ var signature, size, part;
+ while(offset<data.length) {
+ signature = data.readUInt16LE(offset);
+ offset += 2;
+ size = data.readUInt16LE(offset);
+ offset += 2;
+ part = data.slice(offset, offset+size);
+ offset += size;
+ if(Constants.ID_ZIP64 === signature) {
+ parseZip64ExtendedInformation(part);
+ }
+ }
+ }
+
+ //Override header field values with values from the ZIP64 extra field
+ function parseZip64ExtendedInformation(data) {
+ var size, compressedSize, offset, diskNumStart;
+
+ if(data.length >= Constants.EF_ZIP64_SCOMP) {
+ size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);
+ if(_entryHeader.size === Constants.EF_ZIP64_OR_32) {
+ _entryHeader.size = size;
+ }
+ }
+ if(data.length >= Constants.EF_ZIP64_RHO) {
+ compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);
+ if(_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) {
+ _entryHeader.compressedSize = compressedSize;
+ }
+ }
+ if(data.length >= Constants.EF_ZIP64_DSN) {
+ offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);
+ if(_entryHeader.offset === Constants.EF_ZIP64_OR_32) {
+ _entryHeader.offset = offset;
+ }
+ }
+ if(data.length >= Constants.EF_ZIP64_DSN+4) {
+ diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);
+ if(_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {
+ _entryHeader.diskNumStart = diskNumStart;
+ }
+ }
+ }
+
+
return {
get entryName () { return _entryName.toString(); },
get rawEntryName() { return _entryName; },
@@ -150,6 +206,7 @@ module.exports = function (/*Buffer*/input) {
set extra (val) {
_extra = val;
_entryHeader.extraLength = val.length;
+ parseExtra(val);
},
get comment () { return _comment.toString(); },
@@ -180,14 +237,17 @@ module.exports = function (/*Buffer*/input) {
}
},
- getData : function() {
- return decompress(false, null);
+ getData : function(pass) {
+ return decompress(false, null, pass);
},
- getDataAsync : function(/*Function*/callback) {
- decompress(true, callback)
+ getDataAsync : function(/*Function*/callback, pass) {
+ decompress(true, callback, pass)
},
+ set attr(attr) { _entryHeader.attr = attr; },
+ get attr() { return _entryHeader.attr; },
+
set header(/*Buffer*/data) {
_entryHeader.loadFromBinary(data);
},
diff --git a/node_modules/adm-zip/zipFile.js b/node_modules/adm-zip/zipFile.js
index f066d7ed0..ed60fe038 100644
--- a/node_modules/adm-zip/zipFile.js
+++ b/node_modules/adm-zip/zipFile.js
@@ -53,7 +53,7 @@ module.exports = function(/*String|Buffer*/input, /*Number*/inputType) {
function readMainHeader() {
var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size
n = Math.max(0, i - 0xFFFF), // 0xFFFF is the max zip file comment length
- endOffset = 0; // Start offset of the END header
+ endOffset = -1; // Start offset of the END header
for (i; i >= n; i--) {
if (inBuffer[i] != 0x50) continue; // quick check that the byte is 'P'
@@ -62,7 +62,7 @@ module.exports = function(/*String|Buffer*/input, /*Number*/inputType) {
break;
}
}
- if (!endOffset)
+ if (!~endOffset)
throw Utils.Errors.INVALID_FORMAT;
mainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR));