diff --git a/scripts/install.js b/scripts/install.js index 099b2c2b8..35bcf14fe 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -58,6 +58,11 @@ function download(url, dest, cb) { reportError(['HTTP error', response.statusCode, response.statusMessage].join(' ')); } else { console.log('Download complete'); + + if (successful(response)) { + response.pipe(fs.createWriteStream(dest)); + } + cb(); } }) @@ -65,10 +70,6 @@ function download(url, dest, cb) { var length = parseInt(response.headers['content-length'], 10); var progress = log.newItem('', length); - if (successful(response)) { - response.pipe(fs.createWriteStream(dest)); - } - // The `progress` is true by default. However if it has not // been explicitly set it's `undefined` which is considered // as far as npm is concerned.