Skip to main content

@std/uuid@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function generate
generate(
options?: V1Options | null,
buf?: number[],
offset?: number
): string | number[]

Generates a RFC4122 v1 UUID (time-based).

Examples

Example 1

import { generate } from "@std/uuid/v1";

const options = {
  node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
  clockseq: 0x1234,
  msecs: new Date("2011-11-01").getTime(),
  nsecs: 5678,
};

generate(options); // "710b962e-041c-11e1-9234-0123456789ab"

Parameters

optional
options: V1Options | null

Can use RFC time sequence values as overwrites.

optional
buf: number[]

Can allow the UUID to be written in byte-form starting at the offset.

optional
offset: number

Index to start writing on the UUID bytes in buffer.

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/uuid

Import symbol

import { generate } from "@std/uuid/v1";
or

Import directly with a jsr specifier

import { generate } from "jsr:@std/uuid/v1";