From bd65bb67e25a79b019d745b7262b2008ce2adb15 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 16 Nov 2016 01:59:39 +0100 Subject: incrementally verify denoms The denominations are not stored in a separate object store. --- node_modules/adm-zip/util/constants.js | 33 ++++++++++++++++++- node_modules/adm-zip/util/utils.js | 58 ++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 3 deletions(-) (limited to 'node_modules/adm-zip/util') 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); }, -- cgit v1.2.3