detritus

Snowflakenamespace

Generate and take apart Discord-style snowflake ids.

On this page
import { Snowflake } from 'detritus-utils';
3 interfaces · 3 functions

Interfaces

Object shapes for options, payloads and events.

Functions

Standalone helpers.

generate()

function src/snowflake.ts:95
function generate(options?: SnowflakeGenerateOptions): Snowflake

Ids made without timestamp and sequence are unique within this process (for the same workerId and processId), whatever other calls passed An explicit timestamp before the clock's last used millisecond (or past the real clock) can collide with ids made in it Out of range workerIds and processIds are masked to 5 bits