Skip to main content
Home

@std/uuid@1.0.9
Built and signed on GitHub Actions

Generators and validators for UUIDs

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a week ago (1.0.9)
function generate
generate(options?: GenerateOptions): string

Generates a UUIDv1.

Examples

Usage

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

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

const uuid = generate(options);
assert(validate(uuid as string));

Parameters

optional
options: GenerateOptions

Can use RFC time sequence values as overwrites.

Return Type

Returns a UUIDv1 string or an array of 16 bytes.

New Ticket: 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";

Add Package

pnpm i jsr:@std/uuid
or (using pnpm 10.8 or older)
pnpm dlx jsr add @std/uuid

Import symbol

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

Add Package

yarn add jsr:@std/uuid
or (using Yarn 4.8 or older)
yarn dlx jsr add @std/uuid

Import symbol

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

Add Package

vlt install jsr:@std/uuid

Import symbol

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

Add Package

npx jsr add @std/uuid

Import symbol

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

Add Package

bunx jsr add @std/uuid

Import symbol

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