node-native-random-string
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i node-native-random-string

Weekly Downloads

18

Version

1.1.0

License

MIT

Unpacked Size

9.49 kB

Total Files

13

Last publish

Collaborators

  • przpl