Skip to content

Deserializer

[<Interface>]
type Deserializer =
    static member Create (readHeader: unit -> bool, readValue: unit -> obj, transferArrayBuffer: Action<float,ArrayBuffer>, getWireFormatVersion: unit -> float, readUint32: unit -> float, readUint64: unit -> float * float, readDouble: unit -> float, readRawBytes: float -> Buffer<U2<ArrayBuffer,SharedArrayBuffer>>) : Deserializer
    abstract member getWireFormatVersion () : float
    abstract member readDouble () : float
    abstract member readHeader () : bool
    abstract member readRawBytes (length: float) : Buffer<U2<ArrayBuffer,SharedArrayBuffer>>
    abstract member readUint32 () : float
    abstract member readUint64 () : float * float
    abstract member readValue () : obj
    abstract member transferArrayBuffer (id: float, arrayBuffer: ArrayBuffer) : unit
AssemblyXantham.Fable.Node
Attributes[<Interface>]

@since v8.0.0

Methods

static member Create (readHeader: unit -> bool, readValue: unit -> obj, transferArrayBuffer: Action<float,ArrayBuffer>, getWireFormatVersion: unit -> float, readUint32: unit -> float, readUint64: unit -> float * float, readDouble: unit -> float, readRawBytes: float -> Buffer<U2<ArrayBuffer,SharedArrayBuffer>>) : Deserializer
abstract member getWireFormatVersion () : float

Reads the underlying wire format version. Likely mostly to be useful to legacy code reading old wire format versions. May not be called before .readHeader().

abstract member readDouble () : float

Read a JS number value. For use inside of a custom deserializer._readHostObject().

abstract member readHeader () : bool

Reads and validates a header (including the format version). May, for example, reject an invalid or unsupported wire format. In that case, an Error is thrown.

abstract member readRawBytes (length: float) : Buffer<U2<ArrayBuffer,SharedArrayBuffer>>

Read raw bytes from the deserializer's internal buffer. The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes(). For use inside of a custom deserializer._readHostObject().

abstract member readUint32 () : float

Read a raw 32-bit unsigned integer and return it. For use inside of a custom deserializer._readHostObject().

abstract member readUint64 () : float * float

Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries. For use inside of a custom deserializer._readHostObject().

abstract member readValue () : obj

Deserializes a JavaScript value from the buffer and returns it.

abstract member transferArrayBuffer (id: float, arrayBuffer: ArrayBuffer) : unit

Marks an ArrayBuffer as having its contents transferred out of band. Pass the corresponding ArrayBuffer in the serializing context to serializer.transferArrayBuffer() (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers).

Parameter
idA 32-bit unsigned integer.
arrayBufferAn ArrayBuffer instance.