Results.Stream 方法

定義

多載

Stream(Func<Stream,Task>, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

允許直接寫入回應本文。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

Stream(PipeReader, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

將指定 PipeReader 的內容寫入回應。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

Stream(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

將指定的 Stream 寫入回應。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

此 API 是 的 File(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean) 別名。

Stream(Func<Stream,Task>, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

允許直接寫入回應本文。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

public static Microsoft.AspNetCore.Http.IResult Stream (Func<System.IO.Stream,System.Threading.Tasks.Task> streamWriterCallback, string? contentType = default, string? fileDownloadName = default, DateTimeOffset? lastModified = default, Microsoft.Net.Http.Headers.EntityTagHeaderValue? entityTag = default);
static member Stream : Func<System.IO.Stream, System.Threading.Tasks.Task> * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Stream (streamWriterCallback As Func(Of Stream, Task), Optional contentType As String = Nothing, Optional fileDownloadName As String = Nothing, Optional lastModified As Nullable(Of DateTimeOffset) = Nothing, Optional entityTag As EntityTagHeaderValue = Nothing) As IResult

參數

streamWriterCallback
Func<Stream,Task>

可讓使用者直接寫入回應主體的回呼。

contentType
String

回應的 Content-Type。 預設值為 application/octet-stream

fileDownloadName
String

要用於標頭的 Content-Disposition 檔案名。

lastModified
Nullable<DateTimeOffset>

DateTimeOffset上次修改檔案時的 。 用來設定 Last-Modified 回應標頭並執行條件式範圍要求。

entityTag
EntityTagHeaderValue

EntityTagHeaderValue要設定 ETag 回應標頭並執行條件式要求的 。

傳回

為回應建立 IResult 的 。

適用於

Stream(PipeReader, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

將指定 PipeReader 的內容寫入回應。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

public static Microsoft.AspNetCore.Http.IResult Stream (System.IO.Pipelines.PipeReader pipeReader, string? contentType = default, string? fileDownloadName = default, DateTimeOffset? lastModified = default, Microsoft.Net.Http.Headers.EntityTagHeaderValue? entityTag = default, bool enableRangeProcessing = false);
static member Stream : System.IO.Pipelines.PipeReader * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Stream (pipeReader As PipeReader, Optional contentType As String = Nothing, Optional fileDownloadName As String = Nothing, Optional lastModified As Nullable(Of DateTimeOffset) = Nothing, Optional entityTag As EntityTagHeaderValue = Nothing, Optional enableRangeProcessing As Boolean = false) As IResult

參數

pipeReader
PipeReader

PipeReader要寫入回應的 。

contentType
String

回應的 Content-Type。 預設值為 application/octet-stream

fileDownloadName
String

要用於標頭的 Content-Disposition 檔案名。

lastModified
Nullable<DateTimeOffset>

DateTimeOffset上次修改檔案時的 。 用來設定 Last-Modified 回應標頭並執行條件式範圍要求。

entityTag
EntityTagHeaderValue

EntityTagHeaderValue要設定 ETag 回應標頭並執行條件式要求的 。

enableRangeProcessing
Boolean

設定為 true 以啟用範圍要求處理。

傳回

為回應建立 IResult 的 。

備註

在傳送回應之後,參數 pipeReader 就會完成。

適用於

Stream(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

將指定的 Stream 寫入回應。

這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。

此 API 是 的 File(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean) 別名。

public static Microsoft.AspNetCore.Http.IResult Stream (System.IO.Stream stream, string? contentType = default, string? fileDownloadName = default, DateTimeOffset? lastModified = default, Microsoft.Net.Http.Headers.EntityTagHeaderValue? entityTag = default, bool enableRangeProcessing = false);
static member Stream : System.IO.Stream * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Stream (stream As Stream, Optional contentType As String = Nothing, Optional fileDownloadName As String = Nothing, Optional lastModified As Nullable(Of DateTimeOffset) = Nothing, Optional entityTag As EntityTagHeaderValue = Nothing, Optional enableRangeProcessing As Boolean = false) As IResult

參數

stream
Stream

Stream要寫入回應的 。

contentType
String

回應的 Content-Type。 預設值為 application/octet-stream

fileDownloadName
String

要用於標頭的 Content-Disposition 檔案名。

lastModified
Nullable<DateTimeOffset>

DateTimeOffset上次修改檔案時的 。 用來設定 Last-Modified 回應標頭並執行條件式範圍要求。

entityTag
EntityTagHeaderValue

EntityTagHeaderValue要設定 ETag 回應標頭並執行條件式要求的 。

enableRangeProcessing
Boolean

設定為 true 以啟用範圍要求處理。

傳回

為回應建立 IResult 的 。

備註

在傳送回應之後,會 stream 處置 參數。

適用於