From 3051861d8a006de641cd9d5c5dbc762dae7b768a Mon Sep 17 00:00:00 2001 From: Charly Abraham Date: Tue, 31 Oct 2023 23:21:03 +0530 Subject: [PATCH] fix: removed download progress --- src-build/downloadNodeBinary.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src-build/downloadNodeBinary.js b/src-build/downloadNodeBinary.js index 1356eab4..814d8262 100644 --- a/src-build/downloadNodeBinary.js +++ b/src-build/downloadNodeBinary.js @@ -52,32 +52,18 @@ async function downloadNodeBinary(platform, arch, maxRetries = 3) { } const writer = fs.createWriteStream(outputPath); - const { data, headers } = await axios({ + const { data } = await axios({ url: asset.browser_download_url, method: 'GET', responseType: 'stream', timeout: 10000 }); - const str = progress({ - length: headers['content-length'], - time: 100 - }); - - let lastLoggedPercentage = -1; - str.on('progress', progress => { - const percentage = Math.round(progress.percentage); - if (percentage !== lastLoggedPercentage && percentage % 10 === 0) { - console.log(`Downloading... ${percentage}%`); - lastLoggedPercentage = percentage; - } - }); - - data.pipe(str).pipe(writer); + data.pipe(writer); return new Promise((resolve, reject) => { writer.on('finish', () => { - console.log('\nDownload completed:', asset.name); + console.log('Download completed:', asset.name); resolve(asset.name); }); writer.on('error', err => { @@ -97,6 +83,7 @@ async function downloadNodeBinary(platform, arch, maxRetries = 3) { } } + /** * Extracts a tar archive file to the specified output directory. * @param {string} inputFile - The path of the tar archive file to be extracted. @@ -246,4 +233,4 @@ console.log(args); const platformDetails = (args.length === 1) ? JSON.parse(args[0]) : getPlatformDetails(); console.log(platformDetails); -await copyLatestNodeForBuild(platformDetails.platform, platformDetails.arch); +await copyLatestNodeForBuild(platformDetails.platform, platformDetails.arch); \ No newline at end of file