Expose bytes to uuid
See original GitHub issueDo 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:
- Created 7 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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!