Skip to content

_Blob

[<Interface>]
type _Blob =
    abstract member size: float
    abstract member type: string
    static member Create (size: float, type: string, arrayBuffer: unit -> Promise<ArrayBuffer>, bytes: unit -> Promise<Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>>, slice: Func<float option,float option,string option,_Blob>, text: unit -> Promise<string>, stream: unit -> ReadableStream<obj>) : _Blob
    abstract member arrayBuffer () : Promise<ArrayBuffer>
    abstract member bytes () : Promise<Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>>
    abstract member slice (?start: float, ?end: float, ?type: string) : _Blob
    abstract member stream () : ReadableStream<obj>
    abstract member text () : Promise<string>
AssemblyXantham.Fable.Node
Attributes[<Interface>]

A Blob encapsulates immutable, raw data that can be safely shared across multiple worker threads.

@since v15.7.0, v14.18.0

Properties

abstract member size: float

The total size of the Blob in bytes.

@since v15.7.0, v14.18.0

abstract member type: string

The content-type of the Blob.

@since v15.7.0, v14.18.0

Methods

static member Create (size: float, type: string, arrayBuffer: unit -> Promise<ArrayBuffer>, bytes: unit -> Promise<Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>>, slice: Func<float option,float option,string option,_Blob>, text: unit -> Promise<string>, stream: unit -> ReadableStream<obj>) : _Blob
abstract member arrayBuffer () : Promise<ArrayBuffer>

Returns a promise that fulfills with an ArrayBuffer containing a copy of the Blob data.

@since v15.7.0, v14.18.0

abstract member bytes () : Promise<Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>>

The blob.bytes() method returns the byte of the Blob object as a Promise<Uint8Array>.

const blob = new Blob(['hello']);
blob.bytes().then((bytes) => {
console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
});
abstract member slice (?start: float, ?end: float, ?type: string) : _Blob

Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered.

@since v15.7.0, v14.18.0

Parameter
startThe starting index.
endThe ending index.
typeThe content-type for the new Blob
abstract member stream () : ReadableStream<obj>

Returns a new ReadableStream that allows the content of the Blob to be read.

@since v16.7.0

abstract member text () : Promise<string>

Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string.

@since v15.7.0, v14.18.0