Share via


IHostedFileClient.DownloadAsync Method

Definition

Downloads a file from the AI service.

public System.Threading.Tasks.Task<Microsoft.Extensions.AI.HostedFileDownloadStream> DownloadAsync(string fileId, Microsoft.Extensions.AI.HostedFileClientOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DownloadAsync : string * Microsoft.Extensions.AI.HostedFileClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.HostedFileDownloadStream>
Public Function DownloadAsync (fileId As String, Optional options As HostedFileClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HostedFileDownloadStream)

Parameters

fileId
String

The ID of the file to download.

options
HostedFileClientOptions

Options to configure the download.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

A HostedFileDownloadStream containing the file content. The stream should be disposed when no longer needed.

Exceptions

fileId is null.

fileId is empty or whitespace.

Applies to