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

Error when zip has a folder that exists #5

Closed
JoniJnm opened this issue May 29, 2016 · 1 comment
Closed

Error when zip has a folder that exists #5

JoniJnm opened this issue May 29, 2016 · 1 comment

Comments

@JoniJnm
Copy link

JoniJnm commented May 29, 2016

Using v0.3.3.

If the zip has a folder, and it exists, zip-local try to make it throwing an error

Error: EEXIST: file already exists, mkdir 'D:\clientes\ivan\tienda\web\test\myfolder' at Error (native)

I used this test:

  • /
  • /gulpfile.js
  • /test
  • /test/test.zip

Zip content:

  • /
  • /myfolder
  • /myfolder/file.txt
gulp.task('test', function(cb) {
    var zipper = require('zip-local');
    var FS = require('fs');

    var folder = './test';
    var zipFile = folder + '/test.zip';

    zipper.unzip(zipFile, function(err, unzipped) {
        if (err) {
            return cb(err);
        }
        var outputFolder = FS.realpathSync(folder);
        unzipped.save(outputFolder, function(err) {
            if (err) {
                return cb(err);
            }

            cb(); //OK!
        });
    });
});

Execute gulp test twice to see the error (when myfolder exists)

The solution is, I think, to check if the folder exists before create it.

Mostafa-Samir added a commit that referenced this issue Jun 1, 2016
unzipping while a zipped directory already exists
Mostafa-Samir added a commit that referenced this issue Jun 1, 2016
@Mostafa-Samir
Copy link
Owner

Thank you for your feedback. The issue should be fixed now.
Feel free to reopen the issue if you have any further problems.

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

2 participants