From 6107717b958f1f6edea58634565cc8001e2f917e Mon Sep 17 00:00:00 2001 From: nekosu Date: Wed, 23 Aug 2023 00:58:37 +0800 Subject: [PATCH] feat: show progress in bootstrap download --- scripts/bootstrap.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 24c64d3..6d248d6 100644 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -37,6 +37,12 @@ async function downloadTo(url, path) { }).then(response => { return new Promise((resolve, reject) => { response.data.pipe(writer) + const length = response.headers['content-length'] + let current = 0 + response.data.on('data', chunk => { + current += chunk.length + process.stdout.write(`${current} / ${length} \r`) + }) let error = null writer.on('error', err => { error = err