Closed NinjaManatee closed 7 years ago
It depends on how your postProcess
function looks. Currently you are invoking it immediately causing it to run even if download
isn't finished. It should look something like below:
download(zipLocation, distributionDir, {extract: true}).then(postProcess);
// or
download(zipLocation, distributionDir, {extract: true}).then(data => postProcess(data));
Stupid me. I put in extra parentheses. Thanks!
I have code that is supposed download a ZIP file, extract it, then perform some post-processing on the extracted files.
download(zipLocation, distributionDir, { extract: true }) .then(postProcess());
When I run my code, my
postProcess
method fails because the files do not exist. If I remove thethen
, the files download. If I remove thethrow
from my post-process that occurs when the files are not found, the files are downloaded.Am I mistaken that
postProcess
should be called after the download is complete? If so, how should I change my code to get the desire effect?I am using download 6.1.0.