How to use the adm-zip/headers/index.js.MainHeader function in adm-zip

To help you get started, we’ve selected a few adm-zip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imlucas / lone / embed / admzip.js View on Github external
module.exports = function(input, inputType) {
            var entryList = [], entryTable = {}, _comment = new Buffer(0), filename = "", fs = require("fs"), inBuffer = null, mainHeader = new Headers.MainHeader;
            if (inputType == Utils.Constants.FILE) {
                filename = input;
                inBuffer = fs.readFileSync(filename);
                readMainHeader();
            } else if (inputType == Utils.Constants.BUFFER) {
                inBuffer = input;
                readMainHeader();
            } else {}
            function readEntries() {
                entryTable = {};
                entryList = new Array(mainHeader.diskEntries);
                var index = mainHeader.offset;
                for (var i = 0; i < entryList.length; i++) {
                    var tmp = index, entry = new ZipEntry(inBuffer);
                    entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR);
                    entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength);