adm-zip
adm-zip copied to clipboard
Extracting zip causes Node to exit in 0.5.11+
My repro is here: https://github.com/jakebailey/adm-zip-exit-bug
This manifested as https://github.com/jakebailey/every-ts/issues/58; after fetching and extracting, the files are written, but then the process just exits. Pinning back to 0.5.10 fixes the issue.
Reading https://app.renovatebot.com/package-diff?name=adm-zip&from=0.5.10&to=0.5.12, it's not entirely certain to me why this would be happening.
Ah found it, it's the move of fileEntries.delete(entry); to after done(), introduced in https://github.com/cthackers/adm-zip/pull/437.
We are having the same issue.
Ah found it, it's the move of
fileEntries.delete(entry);to afterdone(), introduced in #437.
yep, I was literally just going to open an issue. manually patching or reverting to 0.5.10 should fix the issue.
edit: running npm i && node ./index.js should reproduce the issue, console.log("resolve") (and the callback in general) is never called.
adm-zip-extract-test.zip
I am also experiencing a similar problem with 0.5.11 and 0.5.12. In the very simplified example below, I am unzipping an array buffer using extractAllToAsync:
async function doStuff(payload) {
// Do some work and get the results as a zip archive
const zipResponse = await axios.post(`/api/do-some-work`, payload, { responseType: 'arraybuffer' })
// Extract the response to the target directory
await new Promise((resolve, reject) => {
let extract = new AdmZip(zipResponse.data)
extract.extractAllToAsync('/path/to/files', true, false, (err: any) => {
if (err) {
reject(err)
}
resolve()
})
})
}
In v0.5.11 and 0.5.12, the result callback is never called, the promise is never resolved, and so the doStuff function never returns. So, a different symptom, but it seems like it could be related to the present issue. If not, I will gladly open a new issue with a fully reproducible example.
Thanks!
EDIT: I should have looked closer at jakebailey's example. It's exactly the same problem, so you can ignore my example.
Sadly, I cannot merge @WikiRik PR, any more - but I think I fixed this issue in repo few days ago with my own PR.
There are still some more tests to be done but I think it is fixed.
Seems like this was fixed in 0.5.13+?