Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"EEXIST: file already exists" for directories. #238

Open
Sharian opened this issue May 12, 2021 · 1 comment
Open

"EEXIST: file already exists" for directories. #238

Sharian opened this issue May 12, 2021 · 1 comment

Comments

@Sharian
Copy link

Sharian commented May 12, 2021

I'm using unzipper to unzip a file using the following instructions:

let extract = unzipper.Extract({ path: self.taskPath });
fs.createReadStream(self.uploadedFile)
    .pipe(extract);
extract.on('close', () => {
    console.log('closed zip stream.');
    resolve();
});

extract.on('error', (e) => {
    console.log('error in zip stream: ' + e);
    reject(e);
});

The zip file contains a folder, which contains other files. While attempting to unzip the folder, I am retreiving "EEXIST: file already exists" as a file with the name of the folder has been generated by unzipper.

In

entry.type = (vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName)) ? 'Directory' : 'File';

my folder is detected as a file, because the vars.uncompressedSize is 0xffffffff. Could this be due to the zip using the "Zip64 Format"?

I would also check for 0xffffffff but it seems to me that the file contains two entrys for the folder: The first one being interpreted as a file and the second one being interpreted as a folder, which then causes the EEXIST.

What would your recommendation be on fixing this? I'm willing to help.

@Sharian
Copy link
Author

Sharian commented May 12, 2021

I believe PR #209 is addressing the issue of the folder being parsed twice, but may be mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant