HostedFileDownloadStream Class
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.
Represents a stream for downloading file content from an AI service.
public ref class HostedFileDownloadStream abstract : System::IO::Stream
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")]
public abstract class HostedFileDownloadStream : System.IO.Stream
public abstract class HostedFileDownloadStream : System.IO.Stream
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")>]
type HostedFileDownloadStream = class
inherit Stream
type HostedFileDownloadStream = class
inherit Stream
Public MustInherit Class HostedFileDownloadStream
Inherits Stream
- Inheritance
- Attributes
Remarks
This abstract class extends Stream to provide additional metadata about the downloaded file, such as its media type and file name. Implementations should override the abstract Stream members and optionally override MediaType and FileName to provide file metadata.
The ToDataContentAsync(CancellationToken) method provides a convenient way to buffer the entire stream content into a DataContent instance.
Constructors
| Name | Description |
|---|---|
| HostedFileDownloadStream() |
Initializes a new instance of the HostedFileDownloadStream class. |
Properties
| Name | Description |
|---|---|
| FileName |
Gets the file name. |
| MediaType |
Gets the media type (MIME type) of the file content. |
Methods
| Name | Description |
|---|---|
| ToDataContentAsync(CancellationToken) |
Reads the entire stream content from its current position and returns it as a DataContent. |
Extension Methods
| Name | Description |
|---|---|
| CopyToAsync(Stream, PipeWriter, CancellationToken) |
Asynchronously reads the bytes from the Stream and writes them to the specified PipeWriter, using a cancellation token. |