ffi.toString(pointer): string | null
Attributes
Reads a NUL-terminated UTF-8 string from native memory.
If pointer is 0n, null is returned.
This function does not validate that pointer refers to readable memory or
that the pointed-to data is terminated with \0. Passing an invalid pointer,
a pointer to freed memory, or a pointer to bytes without a terminating NUL can
read unrelated memory, crash the process, or produce truncated or garbled
output.
const { toString } = require('node:ffi'); const value = toString(ptr);