doc: clarify napi_get_value_string_* for bufsize 0
This edge case is ambiguous and it is unclear from the existing documentation what happens in this case.
Review requested:
- [ ] @nodejs/node-api
I would rather change it to say that if bufsize is zero and the buf pointer is not null, then the string is not returned and not measured.
To me the phrase "null-terminated if possible" sounds a bit ambiguous.
We do always null-terminate string when we return it. We obviously cannot null terminate it when we do not return it.
We do not return the string when either buf is null or the bufsize is zero.
The buffer size must be big enough to fit the string and its null terminator.
@tniessen , we discussed this PR in out last Node-API meeting on 5/9/2025. The team advised me to provide the text change suggestions instead of the general comment.
Landed in acb3d922cb25c56308721ddcfa272d6b073bc5e6