IFileDownloader interface
Namespace: Velopack.Sources
A simple abstractable file downloader
public interface IFileDownloader
Methods
| Method | Summary |
|---|---|
DownloadFile | Downloads a remote file to the specified local path |
DownloadBytes | Returns a byte array containing the contents of the file at the specified url |
DownloadString | Returns a string containing the contents of the specified url |
DownloadFile(url, targetFile, progress, headers, timeout, cancelToken)
Task DownloadFile(string url, string targetFile, Action<int> progress, IDictionary<string, string>? headers = null, double timeout = 30, CancellationToken cancelToken = default)
Downloads a remote file to the specified local path
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The url which will be downloaded. |
targetFile | string | The local path where the file will be stored If a file exists at this path, it will be overwritten. |
progress | Action<int> | A delegate for reporting download progress, with expected values from 0-100. |
headers | IDictionary<string, string> | Headers that can be passed to Http Downloader, e.g. Accept or Authorization. |
timeout | double | The maximum time in minutes to wait for the download to complete. |
cancelToken | CancellationToken | Optional token to cancel the request. |
Returns Task
DownloadBytes(url, headers, timeout)
Task<byte[]> DownloadBytes(string url, IDictionary<string, string>? headers = null, double timeout = 30)
Returns a byte array containing the contents of the file at the specified url
Parameters
| Name | Type | Description |
|---|---|---|
url | string | |
headers | IDictionary<string, string> | |
timeout | double |
Returns Task<byte[]>
DownloadString(url, headers, timeout)
Task<string> DownloadString(string url, IDictionary<string, string>? headers = null, double timeout = 30)
Returns a string containing the contents of the specified url
Parameters
| Name | Type | Description |
|---|---|---|
url | string | |
headers | IDictionary<string, string> | |
timeout | double |
Returns Task<string>
Generated from Velopack 1.1.1