Curl.onProgress

The event handler that gets called to inform of upload/download progress.

struct Curl
@property
void
onProgress
(
int delegate
(
size_t dlTotal
,
size_t dlNow
,
size_t ulTotal
,
size_t ulNow
)
callback
)

Parameters

callback int delegate
(
size_t dlTotal
,
size_t dlNow
,
size_t ulTotal
,
size_t ulNow
)

the callback that receives the (total bytes to download, currently downloaded bytes, total bytes to upload, currently uploaded bytes).

Return Value

Type: void

Return 0 from the callback to signal success, return non-zero to abort transfer

Examples

import std.net.curl, std.stdio;
Curl curl;
curl.initialize();
curl.set(CurlOption.url, "http://dlang.org");
curl.onProgress = delegate int(size_t dltotal, size_t dlnow, size_t ultotal, size_t ulnow)
{
    writeln("Progress: downloaded bytes ", dlnow, " of ", dltotal);
    writeln("Progress: uploaded bytes ", ulnow, " of ", ultotal);
    return 0;
};
curl.perform();

Meta