You could have easily found that out for yourself:

Just integrate one of

<https://nimble.directory/search?query=progress>

into

<https://nim-lang.org/docs/httpclient.html#progress-reporting>

For example:
    
    
    import std/[asyncdispatch, httpclient]
    import progress
    
    const nBytes = 1024 * 1024 * 100
    var bar = newProgressBar(total = nBytes)
    
    proc onProgressChanged(total, progress, speed: BiggestInt) {.async.} =
      bar.set(progress.int)
      #echo("Downloaded ", progress, " of ", total)
      #echo("Current rate: ", speed div 1000, "kb/s")
    
    proc asyncProc() {.async.} =
      var client = newAsyncHttpClient()
      client.onProgressChanged = onProgressChanged
      bar.start()
      discard await client.getContent("https://speed.hetzner.de/100MB.bin";)
      bar.finish()
    
    waitFor asyncProc()
    
    
    Run

Reply via email to