Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
children.forEach(function(child) {
if (child.isDirectory) return;
var content = child.getData();
if (!content) {
throw Utils.Errors.CANT_EXTRACT_FILE;
}
Utils.writeFileTo(pth.resolve(targetPath, maintainEntryPath ? child.entryName : child.entryName.substr(item.entryName.length)), content, overwrite);
});
return true;
children.forEach(function(child) {
if (child.isDirectory) return;
var content = child.getData();
if (!content) {
throw Utils.Errors.CANT_EXTRACT_FILE;
}
Utils.writeFileTo(pth.resolve(targetPath, maintainEntryPath ? child.entryName : child.entryName.substr(item.entryName.length)), content, overwrite);
});
return true;
}
var content = item.getData();
if (!content) throw Utils.Errors.CANT_EXTRACT_FILE;
if (fs.existsSync(targetPath) && !overwrite) {
throw Utils.Errors.CANT_OVERRIDE;
}
Utils.writeFileTo(target, content, overwrite);
return true;
},
extractAllTo: function(targetPath, overwrite) {
writeZip: function(targetFileName, callback) {
if (arguments.length == 1) {
if (typeof targetFileName == "function") {
callback = targetFileName;
targetFileName = "";
}
}
if (!targetFileName && _filename) {
targetFileName = _filename;
}
if (!targetFileName) return;
var zipData = _zip.compressToBuffer();
if (zipData) {
Utils.writeFileTo(targetFileName, zipData, true);
}
},
toBuffer: function(onSuccess, onFail, onItemStart, onItemEnd) {