Open BigFunger opened 8 years ago
Same error, change DecompressZip.prototype.extractFiles
in lib/decompress-zip.js
from:
files.forEach(function (file) {
To:
files.filter(function(file) {
return file;
}).forEach(function (file) {
Will resolve this problem.
Can this be merged ?
+1 for merge, fixed my error
Please merge and release new version in npm.
+1 for merge, fixed my error as well
merge this please
For folks running into this, the cause is that this map() doesn't return anything if file.type === 'Directory'
, which leaves the entry in files
array as undefined
.
return
outside of the if()
in the map()
callback.You can work around it by adding this filter to your extract()
call:
unzipper.extract( {
path: '/some/path',
strip: 1,
filter: ( file ) => file.type !== 'Directory',
} );
This seems to work for me, but it might fail under some circumstances. Off the top of my head, I guess it means that empty directories won't be extracted, and there are probably other side effects.
When i specify a strip option, I get the following error:
The code that generates the error is below:
The My-Archive.zip file I am using can be downloaded from here: https://s3.amazonaws.com/jimtars/My-Archive.zip
The zip file was created using 7zip on Windows 8.1.