Skip to content

Commit

Permalink
Merge pull request #298 from leanprover-community/FIX/nothing_here
Browse files Browse the repository at this point in the history
Fix/nothing here
  • Loading branch information
matlorr authored Feb 25, 2025
2 parents 1d55a1b + 4232889 commit 9b5b5e8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions relay/import.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ async function checkAgainstDiscMemory(artifact, reservedMemorySize) {
async function download(id, url, dest) {
return new Promise((resolve, reject) => {
// The options argument is optional so you can omit it
progress[id].output += "Progress: " + "[" + "_".repeat(50) + "]"
let numProgressChars = 0
requestProgress(request({
url,
headers: {
Expand All @@ -73,17 +75,24 @@ async function download(id, url, dest) {
'X-GitHub-Api-Version': '2022-11-28',
'Authorization': 'Bearer ' + TOKEN
}

}))
// choose latest artifact
.on('progress', function (state) {
console.log('progress', state);
transferredDataSize = Math.round(state.size.transferred/1024/1024)
progress[id].output += `Downloaded ${transferredDataSize}MB\n`
//let transferredDataSize = Math.round(state["size"]["transferred"]/1024/1024)
//let totalDataSize = Math.round(state["size"]["total"]/1024/1024)
let step = Math.round(state["percent"] * 100) / 2;
if (step > numProgressChars) {
progress[id].output = progress[id].output.replace(/\[[#_]*\]/, `[${'#'.repeat(numProgressChars) + "_".repeat(50 - numProgressChars)}] `)
numProgressChars = step
//progress[id].output += `|DOWNLOAD (${transferredDataSize}MB / ${totalDataSize}MB): [${'#'.repeat(numProgressChars)}]|`
}
})
.on('error', function (err) {
reject(err)
})
.on('end', function () {
progress[id].output += "\n"
resolve()
})
.pipe(fs.createWriteStream(dest));
Expand Down

0 comments on commit 9b5b5e8

Please sign in to comment.