Interface IMediaDownloader

public interface IMediaDownloader

Media download which uses download file part by part, by ChunkSize.

Namespace

Google.Apis.Download

Assembly

Google.Apis.dll

Properties

ChunkSize

int ChunkSize { get; set; }

Gets or sets the chunk size to download, it defines the size of each part.

Property Value
TypeDescription
Int32

Methods

Download(String, Stream)

IDownloadProgress Download(string url, Stream stream)

Downloads synchronously the given URL to the given stream.

Parameters
TypeNameDescription
Stringurl
Streamstream
Returns
TypeDescription
IDownloadProgress

DownloadAsync(String, Stream)

Task<IDownloadProgress> DownloadAsync(string url, Stream stream)

Downloads asynchronously the given URL to the given stream.

Parameters
TypeNameDescription
Stringurl
Streamstream
Returns
TypeDescription
Task<IDownloadProgress>

DownloadAsync(String, Stream, CancellationToken)

Task<IDownloadProgress> DownloadAsync(string url, Stream stream, CancellationToken cancellationToken)

Downloads asynchronously the given URL to the given stream. This download method supports a cancellation token to cancel a request before it was completed.

Parameters
TypeNameDescription
Stringurl
Streamstream
CancellationTokencancellationToken
Returns
TypeDescription
Task<IDownloadProgress>
Remarks

In case the download fails Exception will contain the exception that cause the failure. The only exception which will be thrown is which indicates that the task was canceled.

Events

ProgressChanged

event Action<IDownloadProgress> ProgressChanged

An event which notifies when the download status has been changed.

Event Type
TypeDescription
Action<IDownloadProgress>

Extension Method