mirror of https://github.com/embarklabs/embark.git
assume cb is always supplied
This commit is contained in:
parent
803b3f5050
commit
a4af0d8f5b
|
@ -161,7 +161,7 @@ function downloadFile(url, dest, cb) {
|
|||
var file = o_fs.createWriteStream(dest);
|
||||
(url.substring(0, 5) === 'https' ? https : http).get(url, function (response) {
|
||||
if (response.statusCode !== 200) {
|
||||
if (cb) cb(`Download failed, response code ${response.statusCode}`);
|
||||
cb(`Download failed, response code ${response.statusCode}`);
|
||||
return;
|
||||
}
|
||||
response.pipe(file);
|
||||
|
@ -170,7 +170,7 @@ function downloadFile(url, dest, cb) {
|
|||
});
|
||||
}).on('error', function (err) {
|
||||
o_fs.unlink(dest);
|
||||
if (cb) cb(err.message);
|
||||
cb(err.message);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue