Interface IMediaDownloader (1.60.0)

public interface IMediaDownloader

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

Namespace

GoogleApisDownload

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
int

Methods

Download(string, Stream)

IDownloadProgress Download(string url, Stream stream)

Downloads synchronously the given URL to the given stream.

Parameters
NameDescription
urlstring
streamStream
Returns
TypeDescription
IDownloadProgress

DownloadAsync(string, Stream)

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

Downloads asynchronously the given URL to the given stream.

Parameters
NameDescription
urlstring
streamStream
Returns
TypeDescription
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
NameDescription
urlstring
streamStream
cancellationTokenCancellationToken
Returns
TypeDescription
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
TypeDescription
ActionIDownloadProgress

Extension Method