Skip to content

Expose bytes to uuid #180

@wesleytodd

Description

@wesleytodd

Do you have any interest in exposing the lib method bytesToUuid?

Usecase: I am writing two uuid's to a buffer which I am hex encoding for use in a http header, but when I decode them, I would like to store are traditional string representation in the XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX format.

It would be nice to do something like:

var buf = Buffer.from(hexEncodedString, 'hex');
var id1 = uuid.bytesToUuid(buf.slice(0, 16));
var id2 = uuid.bytesToUuid(buf.slice(17, 32));

Maybe there is another way to do this that I don't know about, so let me know if that is the case. Otherwise I can submit a PR to expose it.

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