napi_create_buffer_copy

Function napi_create_buffer_copy 

Source
pub unsafe extern "C" fn napi_create_buffer_copy(
    env: napi_env,
    length: usize,
    data: *const c_void,
    result_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 and initializes it with the given data.

§Arguments

  • env - Current running virtual machine context.

  • length - Bytes size of the given data.

  • data - Given data.

  • result_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 or equal to zero.

Available since API-level: 10