napi_get_value_string_latin1


napi_status napi_get_value_string_latin1(napi_env env,
                                         napi_value value,
                                         char* buf,
                                         size_t bufsize,
                                         size_t* result) 
  • [in] env:调用 API 的环境。

    ¥[in] env: The environment that the API is invoked under.

  • [in] valuenapi_value 代表 JavaScript 字符串。

    ¥[in] value: napi_value representing JavaScript string.

  • [in] buf:写入 ISO-8859-1 编码字符串的缓冲区。如果传入 NULL,则在 result 中返回以字节为单位的字符串长度,不包括空终止符。

    ¥[in] buf: Buffer to write the ISO-8859-1-encoded string into. If NULL is passed in, the length of the string in bytes and excluding the null terminator is returned in result.

  • [in] bufsize:目标缓冲区的大小。当此值不足时,返回的字符串将被截断并以 null 终止。

    ¥[in] bufsize: Size of the destination buffer. When this value is insufficient, the returned string is truncated and null-terminated.

  • [out] result:复制到缓冲区中的字节数,不包括空终止符。

    ¥[out] result: Number of bytes copied into the buffer, excluding the null terminator.

如果 API 成功,则返回 napi_ok。如果传入非 string napi_value,则返回 napi_string_expected

¥Returns napi_ok if the API succeeded. If a non-string napi_value is passed in it returns napi_string_expected.

此 API 返回对应于传入值的 ISO-8859-1 编码字符串。

¥This API returns the ISO-8859-1-encoded string corresponding the value passed in.