Interface IMediaDownloader (1.68.0)

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
Type Description
int

Methods

Download(string, Stream)

IDownloadProgress Download(string url, Stream stream)

Downloads synchronously the given URL to the given stream.

Parameters
Name Description
url string
stream Stream
Returns
Type Description
IDownloadProgress

DownloadAsync(string, Stream)

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

Downloads asynchronously the given URL to the given stream.

Parameters
Name Description
url string
stream Stream
Returns
Type Description
TaskIDownloadProgress

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
Name Description
url string
stream Stream
cancellationToken CancellationToken
Returns
Type Description
TaskIDownloadProgress
Remarks

In case the download fails Exception will contain the exception that cause the failure. The only exception which will be thrown is TaskCanceledException 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
Type Description
ActionIDownloadProgress

Extension Method