TheEdoRan / ulid-uuid-converter

A tiny zero dependency library for ULID to UUID conversion and vice versa.
https://npmjs.com/ulid-uuid-converter
MIT License
7 stars 0 forks source link

What version of UUID? #1

Closed quangv closed 9 months ago

quangv commented 10 months ago

Hi, interesting library. I had a question, what version of UUID is it converting to and from?

TheEdoRan commented 10 months ago

Hi, this library converts ULIDs from Crockford's Base32 encoding to Base16 (hex) in a UUID-like format, so it simply does a conversion between the two bases. The output is similar to the upcoming UUIDv7 standard, but not the same, so it's not compatible with it or any other UUID format.

Therefore, this is useful if you want to generate ULIDs in your application and then store them in DBs like Postgres that have a uuid type, which takes up just 16 bytes of space and doesn't require a specific UUID version when inserting, just a representation in this form: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}.

Please let me know if this explanation is good enough of if you need additional info about the lib. Thank you!

quangv commented 9 months ago

Thanks @TheEdoRan !