Skip to content

Commit

Permalink
n-api: document that native strings are copied
Browse files Browse the repository at this point in the history
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 <timothygu99@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
  • Loading branch information
Gabriel Schulhof committed Apr 30, 2018
1 parent 20eaee5 commit 8062431
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ napi_status napi_create_string_latin1(napi_env env,
Returns `napi_ok` if the API succeeded.

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

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

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

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

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

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

0 comments on commit 8062431

Please sign in to comment.