UNPKG

@thi.ng/ksuid

Version:

Configurable K-sortable unique IDs, ULIDs, binary & base-N encoded, 32/48/64bit time resolutions

33 lines 1.3 kB
import type { BaseN } from "@thi.ng/base-n"; import type { IRandom } from "@thi.ng/random"; import type { IKSUID, KSUIDOpts } from "./api.js"; /** * Abstract base class for both 32 & 64bit implementations. See {@link KSUID32} * and {@link KSUID64}. */ export declare abstract class AKSUID implements IKSUID { readonly epochSize: number; readonly size: number; readonly encodedSize: number; readonly base: BaseN; readonly epoch: number; protected tmp: Uint8Array; protected rnd?: IRandom; protected pad: (x: any) => string; protected constructor(epochSize: number, opts: Partial<KSUIDOpts>); next(): string; nextBinary(buf?: Uint8Array): Uint8Array<ArrayBufferLike>; timeOnly(epoch?: number): string; abstract timeOnlyBinary(epoch?: number, buf?: Uint8Array): Uint8Array; fromEpoch(epoch?: number): string; fromEpochBinary(epoch?: number, buf?: Uint8Array): Uint8Array<ArrayBufferLike>; format(buf: Uint8Array): string; abstract parse(id: string): { epoch: number; id: Uint8Array; }; protected ensureSize(buf: Uint8Array): Uint8Array<ArrayBufferLike>; protected ensureTime(t: number, max?: number): number; protected u32(buf: Uint8Array, i?: number): number; } //# sourceMappingURL=aksuid.d.ts.map