question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose bytes to uuid

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
taioncommented, Jul 23, 2020

Passes our test suite. I’ll deploy shortly, but I don’t expect any problems. Will let you know if anything comes up, but assume it’s working fine for us unless you hear otherwise.

1reaction
ctavancommented, Jun 2, 2020

We’re currently considering to extend the API surface of this library (https://github.com/uuidjs/uuid/pull/455#issuecomment-634721504), thank you for bringing up that use case.

We’ll definitely discuss this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert Between Byte Array and UUID in Java | Baeldung
A quick and practical conversion guide between byte arrays and UUID.
Read more >
Convert ByteArray to UUID java - Stack Overflow
The method nameUUIDFromBytes() converts a name into a UUID. Internally, it applied hashing and some black magic to turn any name (i.e. a ......
Read more >
Universally unique identifier - Wikipedia
A universally unique identifier (UUID) is a 128-bit label used for information in computer systems. The term globally unique identifier (GUID) is also...
Read more >
Breaking Down UUIDs | Duo Security
Universally Unique Identifiers, or UUIDS, are 128 bit numbers, composed of 16 octets and represented as 32 base-16 characters, that can be used ......
Read more >
Builder in uuid - Rust - Docs.rs
The Builder type also always exposes APIs to construct Uuid s for any version without ... Creating a version 4 UUID from externally...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found