function

ffi.read.i8

function i8(
ptr: number | bigint | Pointer,
byteOffset?: number
): number;

Read a signed 8-bit integer at ptr + byteOffset

Behaves like DataView, but is usually faster because it doesn't create a DataView or ArrayBuffer.

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

Referenced types

type Pointer = number & { __pointer__: null }