Skip to content

Commit 7ac491b

Browse files
Gabriel SchulhofMylesBorins
Gabriel Schulhof
authored andcommitted
n-api: document that native strings are copied
Mention that a copy is made of the native string by the napi_create_string_* APIs. Fixes: nodejs/abi-stable-node#304 PR-URL: #20425 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
1 parent d7557e1 commit 7ac491b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/api/n-api.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ napi_status napi_create_string_latin1(napi_env env,
15411541
Returns `napi_ok` if the API succeeded.
15421542

15431543
This API creates a JavaScript `String` object from a ISO-8859-1-encoded C
1544-
string.
1544+
string. The native string is copied.
15451545

15461546
The JavaScript `String` type is described in
15471547
[Section 6.1.4][] of the ECMAScript Language Specification.
@@ -1566,6 +1566,7 @@ napi_status napi_create_string_utf16(napi_env env,
15661566
Returns `napi_ok` if the API succeeded.
15671567

15681568
This API creates a JavaScript `String` object from a UTF16-LE-encoded C string.
1569+
The native string is copied.
15691570

15701571
The JavaScript `String` type is described in
15711572
[Section 6.1.4][] of the ECMAScript Language Specification.
@@ -1590,6 +1591,7 @@ if it is null-terminated.
15901591
Returns `napi_ok` if the API succeeded.
15911592

15921593
This API creates a JavaScript `String` object from a UTF8-encoded C string.
1594+
The native string is copied.
15931595

15941596
The JavaScript `String` type is described in
15951597
[Section 6.1.4][] of the ECMAScript Language Specification.

0 commit comments

Comments
 (0)