@litert/uuid
v3.0.0
Published
A uuid generator library for NodeJS.
Readme
LiteRT/UUID
A uuid generator library for NodeJS.
Requirement
- TypeScript v5.0.0 (or newer)
- Node.js v20.0.0 (or newer)
Installation
Install by NPM:
npm i @litert/uuid --saveExports
This package provides the main entry point and several subpath imports:
| Import Path | Description |
| --- | --- |
| @litert/uuid | Main entry — namespace re-exports of all modules |
| @litert/uuid/snowflake | Snowflake generator (64-bit bigint IDs) |
| @litert/uuid/snowflake-si | Snowflake-SI generator (safe-integer number IDs) |
| @litert/uuid/uuid4 | UUIDv4 generator (random UUIDs) |
| @litert/uuid/uuid5 | UUIDv5 generator (namespace + name derived UUIDs) |
| @litert/uuid/uuid7 | UUIDv7 generator (time-ordered UUIDs) |
| @litert/uuid/errors | Error classes (UuidError, E_TIME_REVERSED, etc.) |
| @litert/uuid/constants | Shared enums (ETimeReversedStrategy, ESequenceStrategy) |
| @litert/uuid/utils | Utility functions |
// Namespace import (main entry)
import { Snowflake, UUIDv7 } from '@litert/uuid';
const gen = new Snowflake.SnowflakeGenerator({ machineId: 7 });
// Direct subpath import
import { SnowflakeGenerator } from '@litert/uuid/snowflake';
const gen = new SnowflakeGenerator({ machineId: 7 });Documents
Algorithms
A 64-bit integer UUID algorithm provided by X (Twitter).
A safe-integer Snowflake variant for JavaScript applications.
A random UUID generator.
A deterministic UUID generator based on namespace and name.
A time-ordered UUID generator.
Examples
License
This library is published under Apache-2.0 license.
AI Disclaimer
This project may use AI tools to assist in documentation writing and inspiration for unit test cases, but all code is written and reviewed by human developers.
