From 7ac491b8ac127e2c7aff82b436637f015c722b14 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Sat, 28 Apr 2018 17:33:29 -0400 Subject: [PATCH] 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: https://github.com/nodejs/abi-stable-node/issues/304 PR-URL: https://github.com/nodejs/node/pull/20425 Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Michael Dawson Reviewed-By: Vse Mozhet Byt --- doc/api/n-api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 92340cf834e3f0..bc0db26e352556 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -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. @@ -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. @@ -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.