Skip to content

v8

v8(data?, options?): string

Defined in: src/uuid/v8.ts:23

Version 8 — custom (RFC 9562 §5.8).

The RFC leaves all 122 free bits to you and fixes only the version and variant. Pass 16 bytes and those 6 bits are overwritten in place; the other 122 are yours. Omit the bytes for a random v8, which is a v4 wearing a different version nibble.

Uint8Array<ArrayBufferLike>

UuidOptions = {}

string

v8(); // random, but tagged version 8
// Your own layout: here a big-endian counter in the leading bytes.
const data = new Uint8Array(16);
new DataView(data.buffer).setBigUint64(0, 1756890764019n);
v8(data);