Vibe.d download function, how to get callback when done or error?

Steven Schveighoffer schveiguy at gmail.com
Tue Sep 26 01:39:37 UTC 2023


On 9/23/23 8:07 AM, Joe at bloow.edu wrote:
> I'm using download(url, filename) to download files in vibe.d.
> 
> The issue is that I do not know when the download is finished or errors. 
> There is a callback for the streaming side but not for the file download.
> 

You might misunderstand how vibe is doing async. Basically, that fiber 
is put to sleep until the download is finished, and then you get the 
result. You write your code as if it were synchronous.

If you call this outside of an async context, vibe will start up an 
event loop and run it until your download is done.

-Steve


More information about the Digitalmars-d-learn mailing list