Vibe.d download function, how to get callback when done or error?
Christian Köstlin
christian.koestlin at gmail.com
Sun Sep 24 12:06:27 UTC 2023
On 24.09.23 12:01, Joe at bloow.edu wrote:
> On Saturday, 23 September 2023 at 20:20:31 UTC, Christian Köstlin wrote:
>> On 23.09.23 14:07, 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.
>>>
>> A small test program shows, that if the function return normally the
>> transfer was done (and the file saved).
>> The function raises an exception if there is e,g, an http error status
>> communicated.
>>
>> I am not sure what happens if the download is interrupted in the
>> middle. I guess there will be an exception, but the file might be
>> written partially.
>>
>>
>>
>> Kind regards,
>> Christian
>
> I can't do any testing because overnight for no explicable reason the
> app will not compile any more.
>
> If it is synchronous then I should be able to do what I need without
> issue. When I initially was using it and the way the app works it seemed
> like it was running in parallel because I didn't see it execute
> synchronously because the tasks were relatively short and I just thought
> it was asynchronous for some reason(I didn't give it any thought at the
> time until I got errors in the download and needed to make the code more
> robust but I can't do anything until I figure out why the code no longer
> compiles(I made a post about it but it's not showing up yet).
>
>
I recommend to use
`https://httpbin.org/drip?duration=20&numbytes=100&code=200&delay=0` as
url to test vibes download.
Kind regards,
Christian
More information about the Digitalmars-d-learn
mailing list