Skip to main content

getUuid

@webda/utils


Function: getUuid()

getUuid(format?): string

Defined in: packages/utils/src/uuid.ts:14

Generate a UUID v4 and return it in the requested encoding.

  • "uuid" (default): standard hyphenated UUID string, e.g. "110e8400-e29b-41d4-a716-446655440000"
  • "base64": URL-safe base64 without padding (+ → -, / → _, = stripped)
  • "hex": lowercase hex string without hyphens
  • "binary" / "ascii": raw buffer encoding

Parameters​

format?​

"ascii" | "base64" | "binary" | "hex" | "uuid"

The desired output encoding (default "uuid").

Returns​

string

The UUID in the requested format.