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

Cannot overwrite existing directory if symlink present (OSX) #20

Open
marwanhilmi opened this issue Jan 20, 2016 · 3 comments
Open

Cannot overwrite existing directory if symlink present (OSX) #20

marwanhilmi opened this issue Jan 20, 2016 · 3 comments

Comments

@marwanhilmi
Copy link

Let's say I have x.zip with contains a symlink and I unzip the first time to /foo.
If I try to unzip the same zip (or another zip containing the same symlink) to /foo it will fail with EEXIST. Regular files overwrite as expected (ie fs.writestream by default will overwrite). Unfortunately fs.symlink fails if the symlink already exists.

I can make a PR but do you have any suggestions on how to proceed?
I was thinking we check if the symlink already exists and delete before creating the new symlink.

Furthermore - should overwrite be set by flag (for the regular files as well)?

@max-mapper
Copy link
Owner

Hmm good question, @mafintosh what do you think we should do here?

@canoztokmak
Copy link

having the same issue here..

@cyberalien
Copy link

I had same issue. Temporary workaround is to unlink existing file in onEntry event:

    extract(archive, {
        dir: dir,
        onEntry: (entry, zipfile) => {
            try {
                fs.unlinkSync(dir + '/' + entry.fileName);
            } catch (err) {
            }
        }
    }, err => {
       // ... do stuff
    });

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

4 participants