should return after callback w/ error

This commit is contained in:
Michael Bradley, Jr 2018-09-11 15:22:35 -05:00
parent a44be3740b
commit 803b3f5050
1 changed files with 1 additions and 0 deletions

View File

@ -162,6 +162,7 @@ function downloadFile(url, dest, cb) {
(url.substring(0, 5) === 'https' ? https : http).get(url, function (response) {
if (response.statusCode !== 200) {
if (cb) cb(`Download failed, response code ${response.statusCode}`);
return;
}
response.pipe(file);
file.on('finish', function () {