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) {
var _zip = undefined, _filename = "";
if (input && typeof input === "string") {
if (fs.existsSync(input)) {
_filename = input;
_zip = new ZipFile(input, Utils.Constants.FILE);
} else {
throw Utils.Errors.INVALID_FILENAME;
}
} else if (input && Buffer.isBuffer(input)) {
_zip = new ZipFile(input, Utils.Constants.BUFFER);
} else {
_zip = new ZipFile(null, Utils.Constants.NONE);
}
function getEntry(entry) {
if (entry && _zip) {
var item;
if (typeof entry === "string") item = _zip.getEntry(entry);
if (typeof entry === "object" && entry.entryName != undefined && entry.header != undefined) item = _zip.getEntry(entry.entryName);
if (item) {
return item;
}
}
return null;
}
return {
readFile: function(entry) {
var item = getEntry(entry);
return item && item.getData() || null;
module.exports = function(input) {
var _zip = undefined, _filename = "";
if (input && typeof input === "string") {
if (fs.existsSync(input)) {
_filename = input;
_zip = new ZipFile(input, Utils.Constants.FILE);
} else {
throw Utils.Errors.INVALID_FILENAME;
}
} else if (input && Buffer.isBuffer(input)) {
_zip = new ZipFile(input, Utils.Constants.BUFFER);
} else {
_zip = new ZipFile(null, Utils.Constants.NONE);
}
function getEntry(entry) {
if (entry && _zip) {
var item;
if (typeof entry === "string") item = _zip.getEntry(entry);
if (typeof entry === "object" && entry.entryName != undefined && entry.header != undefined) item = _zip.getEntry(entry.entryName);
if (item) {
return item;
}
module.exports = function(input) {
var _zip = undefined, _filename = "";
if (input && typeof input === "string") {
if (fs.existsSync(input)) {
_filename = input;
_zip = new ZipFile(input, Utils.Constants.FILE);
} else {
throw Utils.Errors.INVALID_FILENAME;
}
} else if (input && Buffer.isBuffer(input)) {
_zip = new ZipFile(input, Utils.Constants.BUFFER);
} else {
_zip = new ZipFile(null, Utils.Constants.NONE);
}
function getEntry(entry) {
if (entry && _zip) {
var item;
if (typeof entry === "string") item = _zip.getEntry(entry);
if (typeof entry === "object" && entry.entryName != undefined && entry.header != undefined) item = _zip.getEntry(entry.entryName);
if (item) {
return item;
}
}
return null;
}
return {
readFile: function(entry) {