Language

IncomingFile.TextAsync(Encoding, CancellationToken) Method

Definition

Convenience: run DownloadAsync(CancellationToken) then decode the bytes as UTF-8 (or a provided encoding). Re-fetches on each call (no memoized bytes); to read bytes several ways hold one DownloadedFile instead. No content-type check; decoding is lossy (invalid bytes become U+FFFD and never throw). For strict or binary-safe reads, use the Bytes of a DownloadAsync(CancellationToken) result.

public System.Threading.Tasks.Task<string> TextAsync(System.Text.Encoding? encoding = default, System.Threading.CancellationToken cancellationToken = default);
member this.TextAsync : System.Text.Encoding * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function TextAsync (Optional encoding As Encoding = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

encoding
Encoding

Encoding to decode with. Defaults to UTF-8.

cancellationToken
CancellationToken

A token to cancel the download.

Returns

Applies to