namespace
ffi.read
namespace read
Read a value directly from a memory address, without creating a DataView or ArrayBuffer
- byteOffset?: number): number;
Read a 32-bit float at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a 64-bit double at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a signed 16-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a signed 32-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): bigint;
Read a signed 64-bit integer at
ptr + byteOffset, as abigintBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a signed 8-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a pointer-sized signed integer (
intptr_t) atptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read a pointer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read an unsigned 16-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read an unsigned 32-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): bigint;
Read an unsigned 64-bit integer at
ptr + byteOffset, as abigintBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading
- byteOffset?: number): number;
Read an unsigned 8-bit integer at
ptr + byteOffsetBehaves like
DataView, but is usually faster because it doesn't create aDataVieworArrayBuffer.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 ptrThe memory address to read
@param byteOffsetbytes to skip before reading