napi_create_buffer

Function napi_create_buffer 

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

Creates an ArkTS ArrayBuffer object of the specified size.

§Arguments

  • env - Current running virtual machine context.

  • length - Bytes size of the underlying arraybuffer.

  • data - Raw pointer to the underlying arraybuffer.

  • result - Created ArkTS ArrayBuffer object.

§Returns

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

[napi_invalid_arg] If env, data or result is nullptr, or length is larger than 2097152, or length is less than zero.

Available since API-level: 10