adm-zip icon indicating copy to clipboard operation
adm-zip copied to clipboard

how to tell if a zip was unziped correctly with `extractAllTo()`?

Open bi-kai opened this issue 7 years ago • 4 comments

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.

bi-kai avatar Aug 25 '18 03:08 bi-kai

Hey @bi-kai, you can use extractAllToAsync which takes a callback like so:

zip.extractAllToAsync(destination, true, (err) = {
})

dawa-coursera avatar Sep 01 '18 05:09 dawa-coursera

@aassahna-coursera hi, i can not find extractAllToAsync in API doc, and the doc does not have demos too.

bi-kai avatar Sep 03 '18 02:09 bi-kai

any update on this issue?

ChandrashekarBemagoni avatar Apr 27 '19 11:04 ChandrashekarBemagoni

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.

therebelrobot avatar Jun 18 '19 19:06 therebelrobot