You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had the same problem. Not sure why, but creating a new DecompressZip object inside the list event fixed it (maybe calling list breaks the internal state of the object?). Not ideal obviously, and a bandaid solution, but worth a shot to anyone else who comes across this. Sample code:
`var unzipper = new DecompressZip(filepath);
//first check the existence of the required files
unzipper.on('list', function(files)
{
console.log("zip files:", files);
//files are there, lets unzip!
if (files.indexOf("html/index.html") != -1)
{
var unzipper = new DecompressZip(filepath);
unzipper.on("extract", function ()
{
//file unzipped, now to handle the folder
if (handleZip(extractPath, res))
{
//success!
}
});
unzipper.extract({ path: extractPath });
}
else
{
//return error etc
}
});
unzipper.list(); `
I want to decompress my archive only if there is a certain file inside. So i call unzipper.list() and check the files in unzipper.on('list')
unzipper.on('list', (files) => { if(fileFound(files){ unzipper.extract({path: folderPath}); }) });
If I do it like that, I got the following error:
"fd must be a file descriptor"
If I just call unzipper.extract() from outside the 'list' event, it works fine.
The text was updated successfully, but these errors were encountered: