serialize

Bun

Symbol

serialize

function serialize(value: any, options?: { binaryType: 'arraybuffer' }): SharedArrayBuffer

Convert a JavaScript value to a binary representation that can be sent to another Bun instance.

Internally, this uses the serialization format from WebKit/Safari.

@param value

A JavaScript value, usually an object or array, to be converted.

@returns

A SharedArrayBuffer that can be sent to another Bun instance.

function serialize(value: any, options?: { binaryType: 'nodebuffer' }): Buffer

Convert a JavaScript value to a binary representation that can be sent to another Bun instance.

Internally, this uses the serialization format from WebKit/Safari.

@param value

A JavaScript value, usually an object or array, to be converted.

@returns

A Buffer that can be sent to another Bun instance.

Referenced types

interface SharedArrayBuffer