Skip to main content

JS_GetArrayBuffer

Function JS_GetArrayBuffer 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_GetArrayBuffer( ctx: *mut JsContext, psize: *mut usize, obj: JsValue, ) -> *mut u8
Expand description

JS_GetArrayBuffer: the bytes of an ArrayBuffer, for a C module to read.

The pointer is borrowed, not owned: it stays valid until the buffer is detached, resized or collected, which is exactly the contract the reference’s own getter has. A resizable or fixed buffer answers the same way — a resize may move the bytes, and the caller is expected to re-fetch after asking a script to run.

§Safety

psize must be null or writable, and obj a live JSValue.