Class ContentDownloader
- Namespace
- Homa.Sdk.Foundation
- Assembly
- Homa.Sdk.Foundation.dll
Downloads and retrieves the content of a file from a given url.
public class ContentDownloader
- Inheritance
-
ContentDownloader
- Inherited Members
Constructors
ContentDownloader(IContentCache, ContentDownloaderOptions)
Downloads and retrieves the content of a file from a given url.
public ContentDownloader(IContentCache contentCache, ContentDownloaderOptions options = null)
Parameters
contentCacheIContentCacheCache that is used to retrieve and store previously downloaded content.
optionsContentDownloaderOptionsContentDownloaderOptions used for configuring the content downloader. Uses default options if no options are provided.
Methods
GetTextContent(string, CancellationToken)
Download and get the content of the file from the given url.
public Task<DownloadResult> GetTextContent(string url, CancellationToken cancellationToken = default)
Parameters
urlstringUrl used to download the content from the server.
cancellationTokenCancellationTokenToken to cancel the download request.
Returns
- Task<DownloadResult>
DownloadResult The result of the download request containing the downloaded content if the request was successful.
Reject(string)
Cancels any in-progress or pending download for the given URL and removes it from the cache.
public Task Reject(string url)
Parameters
urlstringThe URL whose cached content and active request should be discarded.