Show / Hide Table of Contents

Interface IMediaDownloader

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

Namespace: Google.Apis.Download
Assembly: Google.Apis.dll
Syntax
public interface IMediaDownloader

Properties

ChunkSize

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

Declaration
int ChunkSize { get; set; }
Property Value
Type Description
int

Methods

Download(string, Stream)

Downloads synchronously the given URL to the given stream.

Declaration
IDownloadProgress Download(string url, Stream stream)
Parameters
Type Name Description
string url
System.IO.Stream stream
Returns
Type Description
IDownloadProgress

DownloadAsync(string, Stream)

Downloads asynchronously the given URL to the given stream.

Declaration
Task<IDownloadProgress> DownloadAsync(string url, Stream stream)
Parameters
Type Name Description
string url
System.IO.Stream stream
Returns
Type Description
System.Threading.Tasks.Task<TResult><IDownloadProgress>

DownloadAsync(string, Stream, 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.

Declaration
Task<IDownloadProgress> DownloadAsync(string url, Stream stream, CancellationToken cancellationToken)
Parameters
Type Name Description
string url
System.IO.Stream stream
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TResult><IDownloadProgress>
Remarks

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

Events

ProgressChanged

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

Declaration
event Action<IDownloadProgress> ProgressChanged
Event Type
Type Description
System.Action<T><IDownloadProgress>
In This Article
Back to top Generated by DocFX