download


Description:

[ Version ( since = "0.8.0" ) ]
public DownloadStream download (Service service, Cancellable? cancellable = null) throws Error

Downloads and returns a DownloadStream allowing the content represented by this to be read.

To get the content type of the downloaded data, get_content_type can be called on the returned DownloadStream. Calling get_content_length on the stream will not return a meaningful result, however, as the stream is encoded in chunks, rather than by content length.

In order to cancel the download, a Cancellable passed in to cancellable must be cancelled using cancel. Cancelling the individual InputStream operations on the DownloadStream will not cancel the entire download; merely the read or close operation in question. See the cancellable for more details.

Parameters:

this

a MediaContent

service

the Service

cancellable

a Cancellable for the entire download stream, or null

Returns:

a DownloadStream to download the content with, or null; unref with unref