@lukeed/uuid
Fast, zero-dependency UUID v4 and v7 generator returning strings or Uint8Arrays without the uuid package overhead.
Official Documentation ↗v2.0. Check the official docs for the latest API surface.Installation
npm install @lukeed/uuidMethods
No methods match this filter.
@lukeed/uuid is fast, zero-dependency uuid v4 and v7 generator returning strings or uint8arrays without the uuid package overhead. This page documents the core methods, installation, and common usage patterns for the current stable release.
Installation
Install @lukeed/uuid with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.
Core methods
The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v2.0 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.
Frequently asked questions
The faq section in the frontmatter answers the most common questions about @lukeed/uuid, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.
Security
Official security statements captured from the package documentation:
- 默认入口非加密安全,使用 Math.random — “The default is “non-secure”, which uses
Math.randomto produce UUIDs.” (source: https://raw.githubusercontent.com/lukeed/uuid/master/readme.md, fetched 2026-11-08T17:53:00.000Z) - secure 入口使用 crypto 生成加密安全 UUID — “The “secure” mode produces cryptographically secure (CSPRNG) UUIDs using the current environment’s
cryptomodule.” (source: https://raw.githubusercontent.com/lukeed/uuid/master/readme.md, fetched 2026-11-08T17:53:00.000Z) - 非安全模式明确声明不是加密安全 — “Relies on
Math.random, which means that, while faster, this mode is not cryptographically secure.” (source: https://raw.githubusercontent.com/lukeed/uuid/master/readme.md, fetched 2026-11-08T17:53:00.000Z)
API reference evidence
Fetched from official sources on 2026-11-08T17:53:00.000Z via WebFetch https://raw.githubusercontent.com/lukeed/uuid/master/readme.md.
uuid.v4→ signature from https://raw.githubusercontent.com/lukeed/uuid/master/readme.md; official text: “### uuid.v4() Returns:stringCreates a new Version 4 (random) RFC4122 UUID.”uuid.v4→ signature from https://raw.githubusercontent.com/lukeed/uuid/master/readme.md; official text: “### uuid.v4() Returns:stringCreates a new Version 4 (random) RFC4122 UUID.”
FAQ
- Why use v7?
- UUID v7 is time-ordered, so IDs sort chronologically and are more index-friendly than v4.
- Is it faster than the uuid package?
- Yes. It avoids regex and string interpolation; benchmarks show 3-5x speedup.
- Does it support v1?
- No. It focuses on v4 and v7; use the uuid package for v1 or v5.
Report a problem with this API docOpens a pre-filled issue on GitHub.