napi_get_arraybuffer_info

Function napi_get_arraybuffer_info 

Source
pub unsafe extern "C" fn napi_get_arraybuffer_info(
    env: napi_env,
    arraybuffer: napi_value,
    data: *mut *mut c_void,
    byte_length: *mut usize,
) -> napi_status
Available on crate feature napi only.
Expand description

Obtains the underlying data buffer of ArrayBuffer and its length.

§Arguments

  • env - Current running virtual machine context.

  • arraybuffer - The napi_value representing the ArrayBuffer being queried.

  • data - The underlying data buffer of the ArrayBuffer.

  • byte_length - Length in bytes of the underlying data buffer.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If the param env, arraybuffer and(or) byte_length is nullptr.

[napi_arraybuffer_expected] If the param is neither ArkTS TypedArray nor SendableArrayBuffer.

[napi_pending_exception] There is an uncaught exception occurred before(in) execution.

Available since API-level: 10