function
ffi.toArrayBuffer
byteOffset?: number,
byteLength?: number
Read a pointer as an ArrayBuffer
If byteLength is not provided, the pointer is assumed to be 0-terminated.
Bun catches some invalid pointers, but not all. Passing an invalid pointer, or reading past the end of the memory it points to, can crash the program or cause undefined behavior.
@param ptr
The memory address to read
@param byteOffset
bytes to skip before reading
@param byteLength
bytes to read
Referenced types
type Pointer = number & { __pointer__: null }
class ArrayBuffer
Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.