Implement streamed async/sync downloadFile and deprecate old one.
This commit is contained in:
parent
1b4067a81b
commit
f9f86899b5
3 changed files with 62 additions and 16 deletions
|
|
@ -49,7 +49,8 @@ proc asyncTest() {.async.} =
|
|||
echo("Downloaded ", progress, " of ", total)
|
||||
echo("Current rate: ", speed div 1000, "kb/s")
|
||||
client.onProgressChanged = onProgressChanged
|
||||
discard await client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
|
||||
await client.downloadFile("http://speedtest-ams2.digitalocean.com/100mb.test",
|
||||
"100mb.test")
|
||||
|
||||
client.close()
|
||||
|
||||
|
|
@ -96,7 +97,8 @@ proc syncTest() =
|
|||
echo("Downloaded ", progress, " of ", total)
|
||||
echo("Current rate: ", speed div 1000, "kb/s")
|
||||
client.onProgressChanged = onProgressChanged
|
||||
discard client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test")
|
||||
client.downloadFile("http://speedtest-ams2.digitalocean.com/100mb.test",
|
||||
"100mb.test")
|
||||
|
||||
client.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue