META-INF.resources.bower_components.jszip.lib.zipEntry.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-data-tables Show documentation
Show all versions of jwebmp-data-tables Show documentation
The JWebSwing implementation for Data Tables
"use strict";var readerFor=require("./reader/readerFor");var utils=require("./utils");var CompressedObject=require("./compressedObject");var crc32fn=require("./crc32");var utf8=require("./utf8");var compressions=require("./compressions");var support=require("./support");var MADE_BY_DOS=0;var MADE_BY_UNIX=3;var findCompression=function(compressionMethod){for(var method in compressions){if(!compressions.hasOwnProperty(method)){continue}if(compressions[method].magic===compressionMethod){return compressions[method]}}return null};function ZipEntry(options,loadOptions){this.options=options;this.loadOptions=loadOptions}ZipEntry.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(reader){var compression,localExtraFieldsLength;reader.skip(22);this.fileNameLength=reader.readInt(2);localExtraFieldsLength=reader.readInt(2);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)")}compression=findCompression(this.compressionMethod);if(compression===null){throw new Error("Corrupted zip : compression "+utils.pretty(this.compressionMethod)+" unknown (inner file : "+utils.transformTo("string",this.fileName)+")")}this.decompressed=new CompressedObject(this.compressedSize,this.uncompressedSize,this.crc32,compression,reader.readData(this.compressedSize))},readCentralPart:function(reader){this.versionMadeBy=reader.readInt(2);reader.skip(2);this.bitFlag=reader.readInt(2);this.compressionMethod=reader.readString(2);this.date=reader.readDate();this.crc32=reader.readInt(4);this.compressedSize=reader.readInt(4);this.uncompressedSize=reader.readInt(4);var fileNameLength=reader.readInt(2);this.extraFieldsLength=reader.readInt(2);this.fileCommentLength=reader.readInt(2);this.diskNumberStart=reader.readInt(2);this.internalFileAttributes=reader.readInt(2);this.externalFileAttributes=reader.readInt(4);this.localHeaderOffset=reader.readInt(4);if(this.isEncrypted()){throw new Error("Encrypted zip are not supported")}reader.skip(fileNameLength);this.readExtraFields(reader);this.parseZIP64ExtraField(reader);this.fileComment=reader.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null;this.dosPermissions=null;var madeBy=this.versionMadeBy>>8;this.dir=this.externalFileAttributes&16?true:false;if(madeBy===MADE_BY_DOS){this.dosPermissions=this.externalFileAttributes&63}if(madeBy===MADE_BY_UNIX){this.unixPermissions=this.externalFileAttributes>>16&65535}if(!this.dir&&this.fileNameStr.slice(-1)==="/"){this.dir=true}},parseZIP64ExtraField:function(reader){if(!this.extraFields[1]){return}var extraReader=readerFor(this.extraFields[1].value);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){this.diskNumberStart=extraReader.readInt(4)}},readExtraFields:function(reader){var end=reader.index+this.extraFieldsLength,extraFieldId,extraFieldLength,extraFieldValue;if(!this.extraFields){this.extraFields={}}while(reader.index
© 2015 - 2025 Weber Informatics LLC | Privacy Policy