BinaryData
A lightweight abstraction for a payload of bytes that supports converting between string, stream, JSON, and bytes.
Returns an empty BinaryData.
Gets a value that indicates whether this data is empty.
Gets the number of bytes of this data.
Creates a BinaryData instance by wrapping the provided byte array.
Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.
Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.
Creates a BinaryData instance by wrapping the provided bytes.
Creates a BinaryData instance from a string by converting the string to bytes using the UTF-8 encoding.
Creates a BinaryData instance by wrapping the provided ReadOnlyMemory<T>.
Creates a BinaryData instance by wrapping the provided byte array.
public static Task<BinaryData> FromFileAsync(string path, CancellationToken cancellationToken = default)
public static Task<BinaryData> FromFileAsync(string path, string mediaType, CancellationToken cancellationToken = default)
public static BinaryData FromObjectAsJson<T>(T jsonSerializable, JsonSerializerOptions options = null)
Creates a BinaryData instance by serializing the provided object using the JsonSerializer.
Creates a BinaryData instance by serializing the provided object using the JsonSerializer.
Creates a BinaryData instance from the specified stream. The stream is not disposed by this method.
public static Task<BinaryData> FromStreamAsync(Stream stream, CancellationToken cancellationToken = default)
Creates a BinaryData instance from the specified stream. The stream is not disposed by this method.
public static Task<BinaryData> FromStreamAsync(Stream stream, string mediaType, CancellationToken cancellationToken = default)
Creates a BinaryData instance from a string by converting the string to bytes using the UTF-8 encoding.
Defines an implicit conversion from a BinaryData to a ReadOnlyMemory<T>.
Defines an implicit conversion from a BinaryData to a ReadOnlySpan<T>.
Converts the BinaryData to a byte array.
Gets the value of this instance as bytes without any further interpretation.
Converts the BinaryData to the specified type using JsonSerializer.
Converts the BinaryData to the specified type using JsonSerializer.
Converts the BinaryData to a read-only stream.