download_file_async


Description:

public async void download_file_async (DownloadContext context, Cancellable? cancellable = null)

Downloads the file at the given URL asynchronously.

Example

public static int main (string[] args) {
var url = "https://example.com/foo.tgz";
var output_file = GLib.File.new_for_path ("./foo.tgz");
var context = new Catalyst.Http.DownloadContext (url, output_file);
context.progress.connect ((bytes_read, total_bytes) => {
// ...
});
context.complete.connect (() => {
// ...
});
context.failed.connect ((message, status_code) => {
// ...
});
Catalyst.HttpUtils.download_file_async.begin (context, null, (obj, res) => {
Catalyst.HttpUtils.download_file_async.end (res);
});
return 0;
}

Parameters:

context

a Catalyst.Http.DownloadContext providing request details as well as a means of tracking progress and signaling completion/failure

cancellable

a GLib.Cancellable


Namespace: Catalyst.HttpUtils
Package: catalyst-1