From acb3d922cb25c56308721ddcfa272d6b073bc5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Mon, 12 May 2025 18:07:53 +0100 Subject: [PATCH] doc: clarify napi_get_value_string_* for bufsize 0 PR-URL: https://github.com/nodejs/node/pull/58158 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu Reviewed-By: Michael Dawson --- doc/api/n-api.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 5548132dd1c..c94d6f6bb58 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3689,6 +3689,8 @@ napi_status napi_get_value_string_latin1(napi_env env, is returned in `result`. * `[in] bufsize`: Size of the destination buffer. When this value is insufficient, the returned string is truncated and null-terminated. + If this value is zero, then the string is not returned and no changes are done + to the buffer. * `[out] result`: Number of bytes copied into the buffer, excluding the null terminator. @@ -3720,6 +3722,8 @@ napi_status napi_get_value_string_utf8(napi_env env, returned in `result`. * `[in] bufsize`: Size of the destination buffer. When this value is insufficient, the returned string is truncated and null-terminated. + If this value is zero, then the string is not returned and no changes are done + to the buffer. * `[out] result`: Number of bytes copied into the buffer, excluding the null terminator. @@ -3750,6 +3754,8 @@ napi_status napi_get_value_string_utf16(napi_env env, null terminator is returned. * `[in] bufsize`: Size of the destination buffer. When this value is insufficient, the returned string is truncated and null-terminated. + If this value is zero, then the string is not returned and no changes are done + to the buffer. * `[out] result`: Number of 2-byte code units copied into the buffer, excluding the null terminator.