3using System.Net.Http.Headers;
5using Microsoft.Extensions.Logging;
23 readonly ILogger<FileDownloader>
logger;
33 this.logger =
logger ??
throw new ArgumentNullException(nameof(
logger));
39 ArgumentNullException.ThrowIfNull(url);
41 logger.LogDebug(
"Starting download of {url}...", url);
45 var request =
new HttpRequestMessage(
50 if (bearerToken !=
null)
IFileStreamProvider DownloadFile(Uri url, string? bearerToken)
Downloads a file from a given url .A new IFileStreamProvider for the downloaded file.
FileDownloader(IAbstractHttpClientFactory httpClientFactory, ILogger< FileDownloader > logger)
Initializes a new instance of the FileDownloader class.
readonly IAbstractHttpClientFactory httpClientFactory
The IAbstractHttpClientFactory for the FileDownloader.
readonly ILogger< FileDownloader > logger
The ILogger for the FileDownloader.
A IFileStreamProvider that represents the response of HttpRequestMessages.
IHttpClient CreateClient()
Create a IHttpClient.
Interface for asynchronously consuming Streams of files.