ksuid-edge
Version:
Edge and browser-compatible KSUID generator
25 lines (24 loc) • 850 B
TypeScript
declare class KSUID {
/** A string-encoded maximum value for a KSUID */
static MAX_STRING_ENCODED: string;
/** A string-encoded minimum value for a KSUID */
static MIN_STRING_ENCODED: string;
private view;
constructor(buffer: ArrayBufferLike);
get raw(): ArrayBuffer;
get date(): Date;
get timestamp(): number;
get payload(): ArrayBuffer;
get string(): string;
get [Symbol.toStringTag](): string;
compare(other: KSUID): 0 | 1 | -1;
equals(other: KSUID): boolean;
toJSON(): string;
toString(): string;
static random(timestamp?: number): Promise<KSUID>;
static randomSync(timestamp?: number): KSUID;
static fromParts(timestamp: number, payload: Uint8Array): KSUID;
static isValid(buffer: ArrayBufferLike): boolean;
static parse(data: string): KSUID;
}
export = KSUID;