▲ How to Create a Guid/UUID at code.askmein.com▼1 up and 1 down, posted by askmein 2257 days ago 3 comments
jklu 2255 days ago. link parent 1 point ▲ ▼NodeJS support... const crypto = require("crypto"); function createUUID() { const fmt = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"; const rnd = Array.from(crypto.randomBytes(32)).map(n => n & 0xf); const rk = (c, r) => (c == "x" ? r : (r & 0x3) | 0x8).toString(16); return fmt.replace(/[xy]/g, c => rk(c, rnd.pop())); }