You are reading a draft of the next documentation and it's in continuous update so if you don't find what you need please refer to: C++ wrapper classes for the ABI-stable C APIs for Node.js
Creates a new String value from a UTF-8 encoded c++ string.
String::New(napi_env env, const std::string& value);[in] env: Thenapi_envenvironment in which to construct the Value object.[in] value: The C++ primitive from which to instantiate the Value.valuemay be any of:- std::string&
- std::u16string&
- const char*
- const char16_t*
Creates a new empty String
String::New();operator std::string() const;Converts a String value to a UTF-8 encoded C++ string.
operator std::u16string() const;Converts a String value to a UTF-16 encoded C++ string.
std::string Utf8Value() const;Converts a String value to a UTF-8 encoded C++ string.
std::u16string Utf16Value() const;Converts a String value to a UTF-16 encoded C++ string.