HostedFileDownloadStream.ToDataContentAsync(CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads the entire stream content from its current position and returns it as a DataContent.
public virtual System.Threading.Tasks.Task<Microsoft.Extensions.AI.DataContent> ToDataContentAsync(System.Threading.CancellationToken cancellationToken = default);
abstract member ToDataContentAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.DataContent>
override this.ToDataContentAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.DataContent>
Public Overridable Function ToDataContentAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of DataContent)
Parameters
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests.
Returns
A DataContent containing the buffered file content.
Remarks
This method buffers the entire stream content into memory. For large files, consider streaming directly to the destination instead.