using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Velopack.Sources { /// /// A simple abstractable file downloader /// public interface IFileDownloader { /// /// Downloads a remote file to the specified local path /// /// The url which will be downloaded. /// /// The local path where the file will be stored /// If a file exists at this path, it will be overwritten. /// /// A delegate for reporting download progress, with expected values from 0-100. /// /// Headers that can be passed to Http Downloader, e.g. Accept or Authorization. /// /// The maximum time in minutes to wait for the download to complete. /// /// Optional token to cancel the request. Task DownloadFile(string url, string targetFile, Action progress, IDictionary? headers = null, double timeout = 30, CancellationToken cancelToken = default); /// /// Returns a byte array containing the contents of the file at the specified url /// Task DownloadBytes(string url, IDictionary? headers = null, double timeout = 30); /// /// Returns a string containing the contents of the specified url /// Task DownloadString(string url, IDictionary? headers = null, double timeout = 30); } }