Class FileStorageClient
HTTP client that can be used to download and upload files from/to a server
public class FileStorageClient
- Inheritance
-
FileStorageClient
- Inherited Members
Constructors
FileStorageClient(HttpClient, ILogger<FileStorageClient>)
Initializes this object with the given HTTP client and logger
public FileStorageClient(HttpClient client, ILogger<FileStorageClient> logger)
Parameters
client
HttpClientHTTP client
logger
ILogger<FileStorageClient>logger
Fields
DefaultBufferSize
Default buffer size for file operations (80 KB)
public static readonly int DefaultBufferSize
Field Value
LargeFileSize
Maximum file size that can be downloaded without throwing an exception (512 MB)
public static readonly long LargeFileSize
Field Value
MaxFileDownloadSize
Maximum file size that can be downloaded (8 GB)
public static readonly long MaxFileDownloadSize
Field Value
Methods
DownloadFileAsync(Uri, string, bool)
Downloads the file from the provided uri
and saves
it in the provided filePath
public Task<bool> DownloadFileAsync(Uri uri, string filePath, bool failLargeFiles = false)
Parameters
uri
UriURI to download from
filePath
stringPath to save the file
failLargeFiles
boolSet to true to throw an exception if the file is larger than LargeFileSize
Returns
UploadFileAsync(Uri, StreamContent)
Uploads a file to the provided uri
public Task UploadFileAsync(Uri uri, StreamContent fileStream)
Parameters
uri
UrifileStream
StreamContent