gossamer/blob
Types
A file-like object of immutable, raw data. Can be read as text, bytes, or a stream.
See Blob on MDN.
pub type Blob
Values
pub fn array_buffer(
of blob: Blob,
) -> promise.Promise(
Result(array_buffer.ArrayBuffer, js_error.JsError),
)
Reads the blob’s contents as an ArrayBuffer. Returns an error if
the blob cannot be read.
pub fn bytes(
of blob: Blob,
) -> promise.Promise(
Result(uint8_array.Uint8Array, js_error.JsError),
)
Reads the blob’s contents as a Uint8Array. Returns an error if the
blob cannot be read.
pub fn from_buffer(bytes: array_buffer.ArrayBuffer) -> Blob
pub fn from_buffer_with_type(
bytes: array_buffer.ArrayBuffer,
content_type content_type: String,
) -> Blob
pub fn from_data_view(bytes: data_view.DataView) -> Blob
pub fn from_data_view_with_type(
bytes: data_view.DataView,
content_type content_type: String,
) -> Blob
pub fn from_string(content: String) -> Blob
pub fn from_string_with_type(
content: String,
content_type content_type: String,
) -> Blob
pub fn from_typed_array(bytes: typed_array.TypedArray) -> Blob
pub fn from_typed_array_with_type(
bytes: typed_array.TypedArray,
content_type content_type: String,
) -> Blob
pub fn slice_with_type(
blob: Blob,
from start: Int,
to end: Int,
content_type content_type: String,
) -> Blob
pub fn stream(
of blob: Blob,
) -> readable_stream.ReadableStream(uint8_array.Uint8Array)
pub fn text(
of blob: Blob,
) -> promise.Promise(Result(String, js_error.JsError))
Reads the blob’s contents as a UTF-8 string. Returns an error if the blob cannot be read.