Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addLocalFolder: function(localPath, zipPath) {
if (zipPath) {
zipPath = zipPath.split("\\").join("/");
if (zipPath.charAt(zipPath.length - 1) != "/") {
zipPath += "/";
}
} else {
zipPath = "";
}
localPath = localPath.split("\\").join("/");
if (localPath.charAt(localPath.length - 1) != "/") localPath += "/";
if (fs.existsSync(localPath)) {
var items = Utils.findFiles(localPath), self = this;
if (items.length) {
items.forEach(function(path) {
var p = path.split("\\").join("/").replace(localPath, "");
if (p.charAt(p.length - 1) !== "/") {
self.addFile(zipPath + p, fs.readFileSync(path), "", 0);
} else {
self.addFile(zipPath + p, new Buffer(0), "", 0);
}
});
}
} else {
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath);
}
},
addFile: function(entryName, content, comment, attr) {