A cryptographically strong pseudo-random string generator using only the native Node.js crypto
module.
- TypeScript support
- Lightweight - no external dependencies
- Uses randomBytes() and randomInt() functions from the native
crypto
module - Generates random numeric (decimal), hexadecimal, and base64 strings
- Node.js v18.0.0 or higher
import { randomNumeric } from "node-native-random-string";
const numericString = randomNumeric(10); // random 10-digit numeric string
import { randomHex } from "node-native-random-string";
const hexString = randomHex(16); // random 16-character hexadecimal string
import { randomBase64 } from "node-native-random-string";
const base64String = randomBase64(32); // random 32-character base64 string