通过


HostedFileDownloadStream 类

定义

表示用于从 AI 服务下载文件内容的流。

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
继承
HostedFileDownloadStream
属性

注解

此抽象类扩展 Stream 为提供有关下载文件的其他元数据,例如其媒体类型和文件名。 实现应重写抽象 Stream 成员,并选择性地重写 MediaType 并提供 FileName 文件元数据。

该方法 ToDataContentAsync(CancellationToken) 提供了一种将整个流内容缓冲到实例的 DataContent 便捷方法。

构造函数

名称 说明
HostedFileDownloadStream()

初始化 HostedFileDownloadStream 类的新实例。

属性

名称 说明
FileName

获取文件名。

MediaType

获取文件内容的媒体类型(MIME 类型)。

方法

名称 说明
ToDataContentAsync(CancellationToken)

从其当前位置读取整个流内容,并将其作为一个 DataContent返回。

扩展方法

名称 说明
CopyToAsync(Stream, PipeWriter, CancellationToken)

使用取消标记异步读取字节并将其 Stream 写入指定的 PipeWriter字节。

适用于