Interface IMediaDownloader (1.50.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
TypeDescription
Int32

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
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
NameDescription
urlString
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