napi_create_dataview

Function napi_create_dataview 

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

Creates an ArkTS DataView from an existing ArrayBuffer.

§Arguments

  • env - Current running virtual machine context.

  • length - Number of elements in the DataView.

  • arraybuffer - The underlying ArrayBuffer that supports the DataView.

  • byte_offset - The byte offset within the ArrayBuffer from which to start projecting the DataView.

  • result - A napi_value representing an ArkTS DataView.

§Returns

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

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

[napi_arraybuffer_expected] If a non-arraybuffer ArkTS value passed in it.

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

If the sum of byte_length and length is greater than the byte length of

the arraybuffer.

Available since API-level: 10