diff options
author | Sampson Gao <sampsong@ca.ibm.com> | 2017-04-12 20:36:40 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-04-14 23:22:07 +0300 |
commit | ad5f9875589a23642823af6f77164f5595f81809 (patch) | |
tree | fb982163d60ea65e73bbbdc4ad1fa77dec41e629 /src/node_api.h | |
parent | 47c255ef68c54aa4a50ac0512c35fd3acc56b84f (diff) |
n-api: add string api for latin1 encoding
PR-URL: https://github.com/nodejs/node/pull/12368
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Diffstat (limited to 'src/node_api.h')
-rw-r--r-- | src/node_api.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node_api.h b/src/node_api.h index 8791954a377..50b7da64c60 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -121,6 +121,10 @@ NAPI_EXTERN napi_status napi_create_array_with_length(napi_env env, NAPI_EXTERN napi_status napi_create_number(napi_env env, double value, napi_value* result); +NAPI_EXTERN napi_status napi_create_string_latin1(napi_env env, + const char* str, + size_t length, + napi_value* result); NAPI_EXTERN napi_status napi_create_string_utf8(napi_env env, const char* str, size_t length, @@ -172,6 +176,13 @@ NAPI_EXTERN napi_status napi_get_value_string_length(napi_env env, napi_value value, size_t* result); +// Copies LATIN-1 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env, + napi_value value, + char* buf, + size_t bufsize, + size_t* result); + // Copies UTF-8 encoded bytes from a string into a buffer. NAPI_EXTERN napi_status napi_get_value_string_utf8(napi_env env, napi_value value, |