idchunk
v2.2.0
Published
Tiny, Fast & Customizable ID Generator
Maintainers
Readme
⚡ idchunk — Tiny, Fast & Customizable ID Generator
Generate short, secure, and customizable IDs for your applications in milliseconds.
✨ Features
- Tiny: Zero dependencies, minimal footprint.
- Secure & Fast: Uses Node.js
crypto. - Customizable: Choose length and your own character set.
- Reliable: Collision-resistant random IDs.
📦 Installation
npm install idchunkUsage
By default, idchunk() generates a random ID of length 10:
const idchunk = require("idchunk");
console.log(idchunk());
// Example: "aZ8_-kL2pQ"You can specify a custom length:
console.log(idchunk(16));
// Example: "bQ9pL2_-aZ8kL2pQ"Custom character set:
const customValues = "ABC123";
console.log(idchunk(8, customValues));
// Example: "1A23BCAB"API
idchunk(length?: number, customValues?: string): string
length(optional) → Length of the ID (default: 10).customValues(optional) → String of allowed characters (default: a-zA-Z0-9_-).Returns: Random string ID.
How It Works
- Uses Node.js
cryptofor secure random number generation. - Character set:
a-z,A-Z,0-9,_,-.
📄 License
MIT © Garv Thakral
Documentation
Read full documentation here : Read Docs
