napi_get_value_string_utf8

Function napi_get_value_string_utf8 

Source
pub unsafe extern "C" fn napi_get_value_string_utf8(
    env: napi_env,
    value: napi_value,
    buf: *mut c_char,
    bufsize: usize,
    result: *mut usize,
) -> napi_status
Available on crate feature napi only.
Expand description

Obtains the UTF8-encoded string corresponding to the given ArkTS value.

§Arguments

  • env - Current running virtual machine context.

  • value - ArkTS string.

  • buf - Destination buffer that will be filled with the provided UTF8-encoded string.

  • bufsize - The size of the buffer ‘buf’.

  • result - The length of the string in UTF8-encoded format.

§Returns

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

[napi_invalid_arg] If the param env and(or) value is nullptr;

If the param buf and result both are nullptr.

[napi_string_expected] If a non-string ArkTS value passed in it.

Available since API-level: 10