Skip to content

Replacements for uuidv4

crypto.randomUUID (native)

You can use crypto.randomUUID for UUID v4 generation.

Example:

ts
const uuid = crypto.randomUUID()

Or in Node.js via node:crypto:

ts
import * as crypto from 'node:crypto'

const uuid = crypto.randomUUID()

Released under the MIT License. (65e83b3b)