@tomiocodes/uuid
v1.1.2
Published
A simple utility to generate Universally Unique Identifiers.
Downloads
3
Readme
@tomiocodes/uuid
A simple utility to generate Universally Unique Identifiers.
Table of Contents
Description
A simple library to generate UUIDs.
Features
- Written in TypeScript
- Offers CommonJS, ESM bundles
- Fully tested
- Powered by Rust
- Faster than uuid
Installation
yarn add @tomiocodes/uuid
# npm install @tomiocodes/uuid
# pnpm add @tomiocodes/uuid
# Or if you want a CLI Installation
npm i -g @tomiocodes/uuid
Usage
Note: While this section uses require
, the imports match 1:1 with ESM imports. For example const { v4 } = require('@tomiocodes/uuid')
equals import { v4 } from '@tomiocodes/uuid'
.
Basic Usage
const { v4 } = require('@tomiocodes/uuid');
console.log(v4());
CLI Usage
@tomiocodes/uuid 1.1.2
USAGE
uuid-cli <command> [options]
COMMANDS
v1 Generates a timestamp UUID.
v3 <namespace> <name> Generates a MD5 UUID.
v4 Generates a random UUID.
v5 <namespace> <name> Generates a SHA-1 UUID.
validate <uuid> Validates a UUID.
parse <uuid> Provides information about a UUID.
blob <uuid> Converts a UUID to a 22 character URL-friendly blob.
help <command> Display help for a specific command
GLOBAL OPTIONS
-h, --help Display help
-V, --version Display version
--no-color Disable colors
--quiet Quiet mode - only displays warn and error messages
-v, --verbose Verbose mode - will also output debug messages
CLI Auto-completion
Bash
echo "source <(uuid-cli completion bash)" >> ~/.bashrc && source ~/.bashrc
Zsh
echo "source <(uuid-cli completion zsh)" >> ~/.zshrc && source ~/.zshrc
Fish
echo "source <(uuid-cli completion fish)" >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish
API Documentation
For the full API documentation please refer to the TypeDoc generated documentation.