Skip to content

Uint8Array to UTF8 conversion #3

Closed
nodejs/node
#45412
@anonrig

Description

@anonrig

I see that undici is mostly using Buffer.from(name).toString('utf8'). This crosses the JS-C++ boundary 2 times. 1 for initializing, and 1 for toString.

I recommend implementing a function like this:

  • Buffer.asString(name, encoding) which returns string
  • Buffer.asStrings([first, second], encoding) which returns string[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions