Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);