Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(function extractFile() {
if (i < len) {
try {
const entry = zipEntries[i];
if (visitor(entry, i, len) !== false) {
if (entry.isDirectory) {
Utils.makeDir(afs.resolvePath(dest, entry.entryName.toString()));
} else {
const content = entry.getData();
if (!content) {
// FIXME: This is clearly wrong, but not sure if downstream depends on this behavior!
throw Utils.Errors.CANT_EXTRACT_FILE + '2'; // eslint-disable-line no-throw-literal
}
Utils.writeFileTo(
afs.resolvePath(dest, entry.entryName.toString()),
content,
overwrite,
(entry.header.attr && (entry.header.attr >>> 16) || defaultPerm) & 0o777
);
}
}
i++;