crypto.randomUUID() to generate a UUID v4. It works in Bun, Node.js, and browsers, with no dependencies.
Bun also provides
Bun.randomUUIDv7(), which generates a UUID v7.
See Utils.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.