All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.jszip.lib.zipEntries.min.js Maven / Gradle / Ivy

"use strict";var readerFor=require("./reader/readerFor");var utils=require("./utils");var sig=require("./signature");var ZipEntry=require("./zipEntry");var utf8=require("./utf8");var support=require("./support");function ZipEntries(loadOptions){this.files=[];this.loadOptions=loadOptions}ZipEntries.prototype={checkSignature:function(expectedSignature){if(!this.reader.readAndCheckSignature(expectedSignature)){this.reader.index-=4;var signature=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature "+"("+utils.pretty(signature)+", expected "+utils.pretty(expectedSignature)+")")}},isSignature:function(askedIndex,expectedSignature){var currentIndex=this.reader.index;this.reader.setIndex(askedIndex);var signature=this.reader.readString(4);var result=signature===expectedSignature;this.reader.setIndex(currentIndex);return result},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2);this.diskWithCentralDirStart=this.reader.readInt(2);this.centralDirRecordsOnThisDisk=this.reader.readInt(2);this.centralDirRecords=this.reader.readInt(2);this.centralDirSize=this.reader.readInt(4);this.centralDirOffset=this.reader.readInt(4);this.zipCommentLength=this.reader.readInt(2);var zipComment=this.reader.readData(this.zipCommentLength);var decodeParamType=support.uint8array?"uint8array":"array";var decodeContent=utils.transformTo(decodeParamType,zipComment);this.zipComment=this.loadOptions.decodeFileName(decodeContent)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8);this.reader.skip(4);this.diskNumber=this.reader.readInt(4);this.diskWithCentralDirStart=this.reader.readInt(4);this.centralDirRecordsOnThisDisk=this.reader.readInt(8);this.centralDirRecords=this.reader.readInt(8);this.centralDirSize=this.reader.readInt(8);this.centralDirOffset=this.reader.readInt(8);this.zip64ExtensibleData={};var extraDataSize=this.zip64EndOfCentralSize-44,index=0,extraFieldId,extraFieldLength,extraFieldValue;while(index1){throw new Error("Multi-volumes zip are not supported")}},readLocalFiles:function(){var i,file;for(i=0;i0){if(this.isSignature(endOfCentralDirOffset,sig.CENTRAL_FILE_HEADER)){}else{this.reader.zero=extraBytes}}else if(extraBytes<0){throw new Error("Corrupted zip: missing "+Math.abs(extraBytes)+" bytes.")}},prepareReader:function(data){this.reader=readerFor(data)},load:function(data){this.prepareReader(data);this.readEndOfCentral();this.readCentralDir();this.readLocalFiles()}};module.exports=ZipEntries;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy