META-INF.resources.bower_components.jszip.lib.load.min.js Maven / Gradle / Ivy
"use strict";var utils=require("./utils");var external=require("./external");var utf8=require("./utf8");var utils=require("./utils");var ZipEntries=require("./zipEntries");var Crc32Probe=require("./stream/Crc32Probe");var nodejsUtils=require("./nodejsUtils");function checkEntryCRC32(zipEntry){return new external.Promise(function(resolve,reject){var worker=zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe);worker.on("error",function(e){reject(e)}).on("end",function(){if(worker.streamInfo.crc32!==zipEntry.decompressed.crc32){reject(new Error("Corrupted zip : CRC32 mismatch"))}else{resolve()}}).resume()})}module.exports=function(data,options){var zip=this;options=utils.extend(options||{},{base64:false,checkCRC32:false,optimizedBinaryString:false,createFolders:false,decodeFileName:utf8.utf8decode});if(nodejsUtils.isNode&&nodejsUtils.isStream(data)){return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file."))}return utils.prepareContent("the loaded zip file",data,true,options.optimizedBinaryString,options.base64).then(function(data){var zipEntries=new ZipEntries(options);zipEntries.load(data);return zipEntries}).then(function checkCRC32(zipEntries){var promises=[external.Promise.resolve(zipEntries)];var files=zipEntries.files;if(options.checkCRC32){for(var i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy