adm-zip
adm-zip copied to clipboard
how to tell if a zip was unziped correctly with `extractAllTo()`?
extractAllTo() is a sync function but no callback and no returns value.
how to tell if a zip was unziped correctly with extractAllTo()?
if file format is error, the program crashed:
throw Utils.Errors.INVALID_FORMAT;
^
Invalid or unsupported zip format. No END header found
and try catch has nothing to do with this.
Hey @bi-kai, you can use extractAllToAsync which takes a callback like so:
zip.extractAllToAsync(destination, true, (err) = {
})
@aassahna-coursera hi, i can not find extractAllToAsync in API doc, and the doc does not have demos too.
any update on this issue?
It's available in the lib (https://github.com/cthackers/adm-zip/blob/master/adm-zip.js#L459), it's just not described in the README.
By looking at the code, it looks like the signature of the callback is (error?: Error) => void. The error param will be undefined if it was successful.