Dela via


Results.Bytes Method

Definition

Overloads

Bytes(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for File(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

Bytes(ReadOnlyMemory<Byte>, String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

Bytes(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Source:
Results.cs

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for File(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

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

Parameters

contents
Byte[]

The file contents.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

enableRangeProcessing
Boolean

Set to true to enable range requests processing.

lastModified
Nullable<DateTimeOffset>

The DateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

The EntityTagHeaderValue associated with the file.

Returns

The created IResult for the response.

Applies to

Bytes(ReadOnlyMemory<Byte>, String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Source:
Results.cs

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

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

Parameters

contents
ReadOnlyMemory<Byte>

The file contents.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

enableRangeProcessing
Boolean

Set to true to enable range requests processing.

lastModified
Nullable<DateTimeOffset>

The DateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

The EntityTagHeaderValue associated with the file.

Returns

The created IResult for the response.

Applies to