A subclass of Serializer
that serializes TypedArray
(in particular Buffer
) and DataView
objects as host objects, and only stores the part of their underlying ArrayBuffer
s that they are referring to.
class
v8.DefaultSerializer
class DefaultSerializer
Returns the stored internal buffer. This serializer should not be used once the buffer is released. Calling this method results in undefined behavior if a previous write has failed.
- id: number,): void;
Marks an
ArrayBuffer
as having its contents transferred out of band. Pass the correspondingArrayBuffer
in the deserializing context todeserializer.transferArrayBuffer()
.@param idA 32-bit unsigned integer.
@param arrayBufferAn
ArrayBuffer
instance. - value: number): void;
Write a JS
number
value. For use inside of a customserializer._writeHostObject()
. Writes out a header, which includes the serialization format version.
- buffer: TypedArray): void;
Write raw bytes into the serializer's internal buffer. The deserializer will require a way to compute the length of the buffer. For use inside of a custom
serializer._writeHostObject()
. - value: number): void;
Write a raw 32-bit unsigned integer. For use inside of a custom
serializer._writeHostObject()
. - hi: number,lo: number): void;
Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. For use inside of a custom
serializer._writeHostObject()
. - val: any): boolean;
Serializes a JavaScript value and adds the serialized representation to the internal buffer.
This throws an error if
value
cannot be serialized.