kevva / decompress

Extracting archives made easy
MIT License
415 stars 51 forks source link

Getting a `ENOENT: no such file or directory` #68

Open george-norris-salesforce opened 5 years ago

george-norris-salesforce commented 5 years ago

I'm decompressing a folder of files, I'm attempting to write them to dist folder but getting a ENOENT: no such file or directory error. Is this the normal behavior? If so, how does this library handle decompressing something like this?

https://stackoverflow.com/questions/54640595/when-decompressing-zip-in-node-enoent-no-such-file-or-directory

arturojain commented 5 years ago

I'm getting the same error with nested folders.

a1994846931931 commented 5 years ago

I've encountered the same problem. Does anyone have advice?

bilwit commented 4 years ago

I was getting this and the originating error syscall was "link" and after looking on here it appears it doesn't handle symlinks well. The workaround is to use the filter option. https://github.com/kevva/decompress/issues/52

decompress(inputpath, outputpath, { "filter": file => { if (file.type !== "link") { return true; } return false; } }) .then(files => { ... })

hubgit commented 4 years ago

I got an ENOENT: no such file or directory error when file.type was set to file rather than directory for an entry named images/ (possibly because the entry didn't have the appropriate external attributes).

This workaround has been successful:

await decompress(zip, dir, {
  map: (file) => {
    if (file.type === 'file' && file.path.endsWith('/')) {
      file.type = 'directory'
    }
    return file
  },
})
jasonkuhrt commented 3 years ago

Hit this issue on a zip coming from GitHub actions. Solution by @hubgit solved it for me. Thanks!