Skip to content

Add String::New for std::string_view #1703

Closed

Description

@cacharle

It would be nice to have a string "constructor" which takes a string_view

Could be as simple as:

Napi::String::New(napi_env env, std::string_view value)
{
    return Napi::String::New(env, value.data(), value.size());
}

Activity

  1. moved this from Need Triage to Todo in Node-API Team Projecton Jan 30, 2026
  2. legendecas commented on Jan 30, 2026

    @legendecas
    Member

    @cacharle thanks for raising the issue! Would you like to file a PR for this?

    Additionally, we could also review other places that could take an std::string_view, where it takes a string pointer.

  3. moved this from Todo to Has PR in Node-API Team Projecton Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions