Class
SnowflakeUtil
Fluxer snowflake IDs (Twitter layout, custom epoch). Public API is string-only — never number — to avoid precision loss above 2^53.
Constructor
new SnowflakeUtil
()Properties
EPOCH
: (readonly)Methods
dateFromSnowflake
(snowflake: Snowflake): DateDate from a snowflake.
| Param | Type | Description |
|---|---|---|
| snowflake | Snowflake |
deconstruct
(snowflake: Snowflake): DeconstructedSnowflakeDeconstruct a snowflake into timestamp / worker / process / increment.
| Param | Type | Description |
|---|---|---|
| snowflake | Snowflake |
isValid
(snowflake: string): booleanWhether `value` is a non-negative decimal snowflake string (≤ 20 digits).
| Param | Type | Description |
|---|---|---|
| snowflake | string |
parse
(snowflake: Snowflake): bigintParse a snowflake string to bigint.
| Param | Type | Description |
|---|---|---|
| snowflake | Snowflake |
snowflakeFromTimestamp
(timestamp: number): SnowflakeSnowflake string from a Unix timestamp (ms). Useful for pagination (`before` / `after`).
| Param | Type | Description |
|---|---|---|
| timestamp | number |