Skip to content

Rushabh5000/uuid-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uuid-tool

Zero dependencies Node License: MIT Platform

Generate and inspect UUIDs from the terminal. Supports v4 (random), v7 (time-ordered — best for database keys), v3/v5 (deterministic/namespaced), plus an inspect mode that decodes the version, variant, and embedded timestamp. Zero dependencies — uses only Node's built-in crypto.

uuidgen only does v1/v4 and isn't on Windows by default. The uuid npm package isn't a CLI. This is one file that does it all.


Install

npm install -g uuid-tool

Or without installing:

npx uuid-tool v4

Usage

uuid-tool v4                          # Random UUID
uuid-tool v7                          # Time-ordered UUID (great for DB keys)
uuid-tool v7 -n 5                     # Five of them
uuid-tool v5 example.com --namespace dns   # Deterministic
uuid-tool inspect 018f6c8e-...        # Decode version + timestamp
uuid-tool v4 -n 1000 --no-hyphens     # Bulk, no hyphens
uuid-tool nil                         # 00000000-0000-0000-0000-000000000000

Which Version Should I Use?

Version Use it for
v4 General-purpose random IDs. The safe default.
v7 Database primary keys. Time-ordered, so inserts stay sequential and indexes don't fragment — but still globally unique.
v5 Deterministic IDs: same name + namespace always yields the same UUID (SHA-1).
v3 Like v5 but MD5 (legacy).

Inspect / Decode

$ uuid-tool inspect 018f6c8e-7b1a-7c3d-9f2e-1a2b3c4d5e6f

uuid-tool  018f6c8e-7b1a-7c3d-9f2e-1a2b3c4d5e6f

  Version     v7
  Variant     RFC 4122/9562 (10x)
  Timestamp   2024-05-20T10:13:20.000Z  (3s ago)

For v7 and v1 UUIDs the embedded timestamp is extracted and shown as both ISO time and a relative age — handy for telling when a record was created straight from its ID.


Namespaces (v3/v5)

Built-in: dns, url, oid, x500. Or pass any UUID as a custom namespace:

uuid-tool v5 "user@example.com" --namespace url
uuid-tool v5 mykey --namespace 6ba7b810-9dad-11d1-80b4-00c04fd430c8

Options

Flag Description
-n, --count <N> Generate N UUIDs (v4/v7)
--namespace <ns> dns | url | oid | x500 | <uuid>
--upper Uppercase output
--no-hyphens Strip hyphens
--json JSON output

License

MIT


Keywords

uuid generator · uuidv4 · uuidv7 · uuidv5 · generate uuid · guid generator · uuidgen alternative · time-ordered uuid · zero dependencies · cli


Built to solve, shared to help — Rushabh Shah 🛠️✨

One of 40+ zero-dependency developer CLI tools — no node_modules, ever.

About

Generate and inspect UUIDs — v4 random, v7 time-ordered, v3/v5 namespaced, plus decode version & timestamp — zero dependencies

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors