Merge pull request #7693 from enthus1ast/patch-1
copy pastable progress reporting example
This commit is contained in:
commit
4d24eb9464
1 changed files with 2 additions and 1 deletions
|
|
@ -73,12 +73,13 @@
|
||||||
## progress of the HTTP request.
|
## progress of the HTTP request.
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
|
## import asyncdispatch, httpclient
|
||||||
## var client = newAsyncHttpClient()
|
## var client = newAsyncHttpClient()
|
||||||
## proc onProgressChanged(total, progress, speed: BiggestInt) {.async.} =
|
## proc onProgressChanged(total, progress, speed: BiggestInt) {.async.} =
|
||||||
## echo("Downloaded ", progress, " of ", total)
|
## echo("Downloaded ", progress, " of ", total)
|
||||||
## echo("Current rate: ", speed div 1000, "kb/s")
|
## echo("Current rate: ", speed div 1000, "kb/s")
|
||||||
## client.onProgressChanged = onProgressChanged
|
## client.onProgressChanged = onProgressChanged
|
||||||
## discard await client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
|
## discard waitFor client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
|
||||||
##
|
##
|
||||||
## If you would like to remove the callback simply set it to ``nil``.
|
## If you would like to remove the callback simply set it to ``nil``.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue