The code below does not finish. The file is downloaded, is size stays at 0 until I ctrl-C the program. (using win11)
import std/[asyncdispatch, asyncftpclient]
proc main() {.async.} =
var msg:string
var ftp = newAsyncFtpClient("ftp.knmi.nl", user = "anonymous", pass = "[email protected]")
await ftp.connect()
echo "Connected"
await ftp.cd("pub_weerberichten")
await ftp.retrFile("tabel_10Min_data.json", "tabel_10Min_data.json")
#something here?
# The EvRetr event is passed to the specified handleEvent function
# when the download is finished. The event's filename field will be
# equal to file.
# Sorry, this is meaningless to me.
let msg = await ftp.send("quit")
echo msg
waitFor(main())