Open
Description
Using extract-zip 2.0.1., node 16.19, and CentOS 7, there is an error when extracting a zip file using the "overwrite: true" option.
[Error: EEXIST: file already exists, symlink 'catalog_libraries.json' -> '/home/trudolph/exp/output/catalog/catalog_builds.json'] {
errno: -17,
code: 'EEXIST',
syscall: 'symlink',
path: 'catalog_libraries.json',
dest: '/home/trudolph/exp/output/catalog/catalog_builds.json'
}
It seems to me that it should overwrite the symlinks as well as the regular files.
Using information found in the source code and in #20, I coded the following to make it work.
await extract('catalog2.zip', {
dir: realDest,
overwrite: true,
onEntry: (entry, zip) => {
// handle link overwrite
const mode = (entry.externalFileAttributes >> 16) & 0xFFFF; // convert to fs stat mode
const IFMT = 61440;
const IFLNK = 40960;
const symlink = (mode & IFMT) === IFLNK;
if (sysmlink) {
fs.unlinkSync(dir + '/' + entry.fileName);
}
console.log(entry);
}
});
This works adequately for now, but I am hoping that there will be a fix in extract-zip.
Thank you
Metadata
Metadata
Assignees
Labels
No labels