Freigeben über


HostedFileClientExtensions.DownloadToAsync Methode

Definition

Lädt eine Datei herunter und speichert sie in einem lokalen Pfad.

public static System.Threading.Tasks.Task<string> DownloadToAsync(this Microsoft.Extensions.AI.IHostedFileClient client, string fileId, string destinationPath, Microsoft.Extensions.AI.HostedFileClientOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member DownloadToAsync : Microsoft.Extensions.AI.IHostedFileClient * string * string * Microsoft.Extensions.AI.HostedFileClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function DownloadToAsync (client As IHostedFileClient, fileId As String, destinationPath As String, Optional options As HostedFileClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameter

client
IHostedFileClient

Der Dateiclient.

fileId
String

Die ID der herunterzuladenden Datei.

destinationPath
String

Der Pfad zum Speichern der Datei. Wenn der Pfad ein Verzeichnis oder leer ist, wird der Dateiname abgeleitet. Ein leerer Pfad wird als aktuelles Verzeichnis behandelt.

options
HostedFileClientOptions

Optionen zum Konfigurieren des Downloads.

cancellationToken
CancellationToken

Der CancellationToken zu überwachende Monitor für Abbruchanforderungen.

Gibt zurück

Der tatsächliche Pfad, in dem die Datei gespeichert wurde.

Ausnahmen

destinationPath ist null.

fileId ist leer oder Leerzeichen.

Eine Datei am Zielpfad ist bereits vorhanden.

Gilt für: