Re: Help with asynchronously downloading file

2016-08-19 Thread hcorion
Alright, So I tried to create a simple AsyncHttpClient, but I was unable to figure out how to use it... This is as far as I got: import httpclient, asyncdispatch, os proc main() {.async.} = var client = newAsyncHttpClient() echo("HERE!") var resp = await client

Re: Help with asynchronously downloading file

2016-08-18 Thread dom96
Sorry. Not AsyncHttpServer, I meant AsyncHttpClient :)

Re: Help with asynchronously downloading file

2016-08-18 Thread hcorion
Thanks dom96, when I try to download using httpclient.download file I get Error: 'threadFunc' is not GC-safe as it accesses 'defaultSSLContext' which is a global using GC'ed memory I've never used threads before, so my scripting may be wrong, here is my attempt at it:

Re: Help with asynchronously downloading file

2016-08-15 Thread dom96
Hello! You won't be able to get the progress of the download easily (unless you hack on the stdlib a bit). But as for downloading without blocking your GUI you've got two options I think: * Run `httpclient.downloadFile` (or `get`) in a different thread. * Use the `AsyncHttpServer` and poll

Help with asynchronously downloading file

2016-08-14 Thread hcorion
Hi all! So I'm writing a custom sort of package manager. However it needs to be GUI, and I can't just stop the gui and download the files (taking up to 4-5 mins to download). So, when the user presses a button, it will trigger a procedure that should check if a download has been started, if it h