Table of Contents

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

contentCache IContentCache

Cache that is used to retrieve and store previously downloaded content.

options ContentDownloaderOptions

ContentDownloaderOptions 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

url string

Url used to download the content from the server.

cancellationToken CancellationToken

Token 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

url string

The URL whose cached content and active request should be discarded.

Returns

Task