1.1.0 • Published 1 year ago

node-native-random-string v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

node-native-random-string

NPM version NPM downloads NPM bundle size

Description

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

Requirements

  • Node.js v18.0.0 or higher

Examples

Random numeric string

import { randomNumeric } from "node-native-random-string";

const numericString = randomNumeric(10); // random 10-digit numeric string

Random hexadecimal string

import { randomHex } from "node-native-random-string";

const hexString = randomHex(16); // random 16-character hexadecimal string

Random base64 string

import { randomBase64 } from "node-native-random-string";

const base64String = randomBase64(32); // random 32-character base64 string
1.1.0

1 year ago

1.0.0

2 years ago