diff options
Diffstat (limited to 'node_modules/adm-zip/util')
-rw-r--r-- | node_modules/adm-zip/util/constants.js | 115 | ||||
-rw-r--r-- | node_modules/adm-zip/util/errors.js | 35 | ||||
-rw-r--r-- | node_modules/adm-zip/util/fattr.js | 84 | ||||
-rw-r--r-- | node_modules/adm-zip/util/index.js | 4 | ||||
-rw-r--r-- | node_modules/adm-zip/util/utils.js | 199 |
5 files changed, 0 insertions, 437 deletions
diff --git a/node_modules/adm-zip/util/constants.js b/node_modules/adm-zip/util/constants.js deleted file mode 100644 index ea8ecb001..000000000 --- a/node_modules/adm-zip/util/constants.js +++ /dev/null @@ -1,115 +0,0 @@ -module.exports = {
- /* The local file header */
- LOCHDR : 30, // LOC header size
- LOCSIG : 0x04034b50, // "PK\003\004"
- LOCVER : 4, // version needed to extract
- LOCFLG : 6, // general purpose bit flag
- LOCHOW : 8, // compression method
- LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)
- LOCCRC : 14, // uncompressed file crc-32 value
- LOCSIZ : 18, // compressed size
- LOCLEN : 22, // uncompressed size
- LOCNAM : 26, // filename length
- LOCEXT : 28, // extra field length
-
- /* The Data descriptor */
- EXTSIG : 0x08074b50, // "PK\007\008"
- EXTHDR : 16, // EXT header size
- EXTCRC : 4, // uncompressed file crc-32 value
- EXTSIZ : 8, // compressed size
- EXTLEN : 12, // uncompressed size
-
- /* The central directory file header */
- CENHDR : 46, // CEN header size
- CENSIG : 0x02014b50, // "PK\001\002"
- CENVEM : 4, // version made by
- CENVER : 6, // version needed to extract
- CENFLG : 8, // encrypt, decrypt flags
- CENHOW : 10, // compression method
- CENTIM : 12, // modification time (2 bytes time, 2 bytes date)
- CENCRC : 16, // uncompressed file crc-32 value
- CENSIZ : 20, // compressed size
- CENLEN : 24, // uncompressed size
- CENNAM : 28, // filename length
- CENEXT : 30, // extra field length
- CENCOM : 32, // file comment length
- CENDSK : 34, // volume number start
- CENATT : 36, // internal file attributes
- CENATX : 38, // external file attributes (host system dependent)
- CENOFF : 42, // LOC header offset
-
- /* The entries in the end of central directory */
- ENDHDR : 22, // END header size
- ENDSIG : 0x06054b50, // "PK\005\006"
- ENDSUB : 8, // number of entries on this disk
- ENDTOT : 10, // total number of entries
- ENDSIZ : 12, // central directory size in bytes
- ENDOFF : 16, // offset of first CEN header
- ENDCOM : 20, // zip file comment length
-
- /* Compression methods */
- STORED : 0, // no compression
- SHRUNK : 1, // shrunk
- REDUCED1 : 2, // reduced with compression factor 1
- REDUCED2 : 3, // reduced with compression factor 2
- REDUCED3 : 4, // reduced with compression factor 3
- REDUCED4 : 5, // reduced with compression factor 4
- IMPLODED : 6, // imploded
- // 7 reserved
- DEFLATED : 8, // deflated
- ENHANCED_DEFLATED: 9, // enhanced deflated
- PKWARE : 10,// PKWare DCL imploded
- // 11 reserved
- BZIP2 : 12, // compressed using BZIP2
- // 13 reserved
- LZMA : 14, // LZMA
- // 15-17 reserved
- IBM_TERSE : 18, // compressed using IBM TERSE
- IBM_LZ77 : 19, //IBM LZ77 z
-
- /* General purpose bit flag */
- FLG_ENC : 0, // encripted file
- FLG_COMP1 : 1, // compression option
- FLG_COMP2 : 2, // compression option
- FLG_DESC : 4, // data descriptor
- FLG_ENH : 8, // enhanced deflation
- FLG_STR : 16, // strong encryption
- FLG_LNG : 1024, // language encoding
- FLG_MSK : 4096, // mask header values
-
- /* Load type */
- FILE : 0,
- BUFFER : 1,
- 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/errors.js b/node_modules/adm-zip/util/errors.js deleted file mode 100644 index db5d69e9a..000000000 --- a/node_modules/adm-zip/util/errors.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = {
- /* Header error messages */
- "INVALID_LOC" : "Invalid LOC header (bad signature)",
- "INVALID_CEN" : "Invalid CEN header (bad signature)",
- "INVALID_END" : "Invalid END header (bad signature)",
-
- /* ZipEntry error messages*/
- "NO_DATA" : "Nothing to decompress",
- "BAD_CRC" : "CRC32 checksum failed",
- "FILE_IN_THE_WAY" : "There is a file in the way: %s",
- "UNKNOWN_METHOD" : "Invalid/unsupported compression method",
-
- /* Inflater error messages */
- "AVAIL_DATA" : "inflate::Available inflate data did not terminate",
- "INVALID_DISTANCE" : "inflate::Invalid literal/length or distance code in fixed or dynamic block",
- "TO_MANY_CODES" : "inflate::Dynamic block code description: too many length or distance codes",
- "INVALID_REPEAT_LEN" : "inflate::Dynamic block code description: repeat more than specified lengths",
- "INVALID_REPEAT_FIRST" : "inflate::Dynamic block code description: repeat lengths with no first length",
- "INCOMPLETE_CODES" : "inflate::Dynamic block code description: code lengths codes incomplete",
- "INVALID_DYN_DISTANCE": "inflate::Dynamic block code description: invalid distance code lengths",
- "INVALID_CODES_LEN": "inflate::Dynamic block code description: invalid literal/length code lengths",
- "INVALID_STORE_BLOCK" : "inflate::Stored block length did not match one's complement",
- "INVALID_BLOCK_TYPE" : "inflate::Invalid block type (type == 3)",
-
- /* ADM-ZIP error messages */
- "CANT_EXTRACT_FILE" : "Could not extract the file",
- "CANT_OVERRIDE" : "Target file already exists",
- "NO_ZIP" : "No zip file was loaded",
- "NO_ENTRY" : "Entry doesn't exist",
- "DIRECTORY_CONTENT_ERROR" : "A directory cannot have content",
- "FILE_NOT_FOUND" : "File not found: %s",
- "NOT_IMPLEMENTED" : "Not implemented",
- "INVALID_FILENAME" : "Invalid filename",
- "INVALID_FORMAT" : "Invalid or unsupported zip format. No END header found"
-};
\ No newline at end of file diff --git a/node_modules/adm-zip/util/fattr.js b/node_modules/adm-zip/util/fattr.js deleted file mode 100644 index 2191ec1c1..000000000 --- a/node_modules/adm-zip/util/fattr.js +++ /dev/null @@ -1,84 +0,0 @@ -var fs = require("fs"),
- pth = require("path");
-
-fs.existsSync = fs.existsSync || pth.existsSync;
-
-module.exports = function(/*String*/path) {
-
- var _path = path || "",
- _permissions = 0,
- _obj = newAttr(),
- _stat = null;
-
- function newAttr() {
- return {
- directory : false,
- readonly : false,
- hidden : false,
- executable : false,
- mtime : 0,
- atime : 0
- }
- }
-
- if (_path && fs.existsSync(_path)) {
- _stat = fs.statSync(_path);
- _obj.directory = _stat.isDirectory();
- _obj.mtime = _stat.mtime;
- _obj.atime = _stat.atime;
- _obj.executable = !!(1 & parseInt ((_stat.mode & parseInt ("777", 8)).toString (8)[0]));
- _obj.readonly = !!(2 & parseInt ((_stat.mode & parseInt ("777", 8)).toString (8)[0]));
- _obj.hidden = pth.basename(_path)[0] === ".";
- } else {
- console.warn("Invalid path: " + _path)
- }
-
- return {
-
- get directory () {
- return _obj.directory;
- },
-
- get readOnly () {
- return _obj.readonly;
- },
-
- get hidden () {
- return _obj.hidden;
- },
-
- get mtime () {
- return _obj.mtime;
- },
-
- get atime () {
- return _obj.atime;
- },
-
-
- get executable () {
- return _obj.executable;
- },
-
- decodeAttributes : function(val) {
-
- },
-
- encodeAttributes : function (val) {
-
- },
-
- toString : function() {
- return '{\n' +
- '\t"path" : "' + _path + ",\n" +
- '\t"isDirectory" : ' + _obj.directory + ",\n" +
- '\t"isReadOnly" : ' + _obj.readonly + ",\n" +
- '\t"isHidden" : ' + _obj.hidden + ",\n" +
- '\t"isExecutable" : ' + _obj.executable + ",\n" +
- '\t"mTime" : ' + _obj.mtime + "\n" +
- '\t"aTime" : ' + _obj.atime + "\n" +
- '}';
- }
- }
-
-};
diff --git a/node_modules/adm-zip/util/index.js b/node_modules/adm-zip/util/index.js deleted file mode 100644 index 935fc1a4f..000000000 --- a/node_modules/adm-zip/util/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = require("./utils");
-module.exports.Constants = require("./constants");
-module.exports.Errors = require("./errors");
-module.exports.FileAttr = require("./fattr");
\ No newline at end of file diff --git a/node_modules/adm-zip/util/utils.js b/node_modules/adm-zip/util/utils.js deleted file mode 100644 index 528109845..000000000 --- a/node_modules/adm-zip/util/utils.js +++ /dev/null @@ -1,199 +0,0 @@ -var fs = require("fs"),
- pth = require('path');
-
-fs.existsSync = fs.existsSync || pth.existsSync;
-
-module.exports = (function() {
-
- var crcTable = [],
- Constants = require('./constants'),
- Errors = require('./errors'),
-
- PATH_SEPARATOR = pth.normalize("/");
-
-
- function mkdirSync(/*String*/path) {
- var resolvedPath = path.split(PATH_SEPARATOR)[0];
- path.split(PATH_SEPARATOR).forEach(function(name) {
- if (!name || name.substr(-1,1) == ":") return;
- resolvedPath += PATH_SEPARATOR + name;
- var stat;
- try {
- stat = fs.statSync(resolvedPath);
- } catch (e) {
- fs.mkdirSync(resolvedPath);
- }
- if (stat && stat.isFile())
- throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath);
- });
- }
-
- function findSync(/*String*/root, /*RegExp*/pattern, /*Boolean*/recoursive) {
- if (typeof pattern === 'boolean') {
- recoursive = pattern;
- pattern = undefined;
- }
- var files = [];
- fs.readdirSync(root).forEach(function(file) {
- var path = pth.join(root, file);
-
- if (fs.statSync(path).isDirectory() && recoursive)
- files = files.concat(findSync(path, pattern, recoursive));
-
- if (!pattern || pattern.test(path)) {
- files.push(pth.normalize(path) + (fs.statSync(path).isDirectory() ? PATH_SEPARATOR : ""));
- }
-
- });
- return files;
- }
-
- return {
- makeDir : function(/*String*/path) {
- mkdirSync(path);
- },
-
- crc32 : function(buf) {
- var b = new Buffer(4);
- if (!crcTable.length) {
- for (var n = 0; n < 256; n++) {
- var c = n;
- for (var k = 8; --k >= 0;) //
- if ((c & 1) != 0) { c = 0xedb88320 ^ (c >>> 1); } else { c = c >>> 1; }
- if (c < 0) {
- b.writeInt32LE(c, 0);
- c = b.readUInt32LE(0);
- }
- crcTable[n] = c;
- }
- }
- var crc = 0, off = 0, len = buf.length, c1 = ~crc;
- while(--len >= 0) c1 = crcTable[(c1 ^ buf[off++]) & 0xff] ^ (c1 >>> 8);
- crc = ~c1;
- b.writeInt32LE(crc & 0xffffffff, 0);
- return b.readUInt32LE(0);
- },
-
- methodToString : function(/*Number*/method) {
- switch (method) {
- case Constants.STORED:
- return 'STORED (' + method + ')';
- case Constants.DEFLATED:
- return 'DEFLATED (' + method + ')';
- default:
- return 'UNSUPPORTED (' + method + ')';
- }
-
- },
-
- writeFileTo : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr) {
- if (fs.existsSync(path)) {
- if (!overwrite)
- return false; // cannot overwite
-
- var stat = fs.statSync(path);
- if (stat.isDirectory()) {
- return false;
- }
- }
- var folder = pth.dirname(path);
- if (!fs.existsSync(folder)) {
- mkdirSync(folder);
- }
-
- var fd;
- try {
- fd = fs.openSync(path, 'w', 438); // 0666
- } catch(e) {
- fs.chmodSync(path, 438);
- fd = fs.openSync(path, 'w', 438);
- }
- if (fd) {
- fs.writeSync(fd, content, 0, content.length, 0);
- fs.closeSync(fd);
- }
- fs.chmodSync(path, attr || 438);
- 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);
- },
-
- getAttributes : function(/*String*/path) {
-
- },
-
- setAttributes : function(/*String*/path) {
-
- },
-
- toBuffer : function(input) {
- if (Buffer.isBuffer(input)) {
- return input;
- } else {
- if (input.length == 0) {
- return new Buffer(0)
- }
- return new Buffer(input, 'utf8');
- }
- },
-
- Constants : Constants,
- Errors : Errors
- }
-})();
|