npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rsg-util

v1.1.11

Published

A lightweight utility to generate random strings

Readme

rsg-util

A simple utility to generate random strings with optional timestamp support. Includes UUID and readable generators, CLI, and interactive mode.


📦 Installation

npm install rsg-util

Or run instantly using npx:

npx rsg-util

🔧 Usage in Code

CommonJS (Node default)

const {
  rsgUtil,
  rsgUtilShort,
  rsgUtilHex,
  rsgUtilUUID,
} = require('rsg-util');

ES Modules (ESM)

import {
  rsgUtil,
  rsgUtilShort,
  rsgUtilHex,
  rsgUtilUUID,
} from 'rsg-util';

🧠 TypeScript Support

This package includes full TypeScript typings (index.d.ts) out of the box — no config needed.


⚡ Examples

// Basic 10-character alphanumeric string
console.log(rsgUtil()); // e.g., 'aZ0bXc93Lm'

// 12-character string with timestamp
console.log(rsgUtil(12, true)); // e.g., 'G7xP9wQa0BcZ1712384600123'

// 8-character string with timestamp and dash separator
console.log(rsgUtil(8, true, '-')); // e.g., 'a9f2d1c3-1712384611123'

// Custom charset
console.log(rsgUtil(6, false, '', 'ABC123')); // e.g., 'A2C1B3'

// Short 6-character string
console.log(rsgUtilShort()); // e.g., 'Tz3Xy7'

// Hex-style string
console.log(rsgUtilHex()); // e.g., 'a3b9d4f2'

// UUID v4
console.log(rsgUtilUUID()); // e.g., 'ae1b765d-d232-45e2-9a89-7b292278b917'

🛠️ API

rsgUtil(length = 10, withTimestamp = false, separator = '', charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')

| Parameter | Type | Description | |----------------|-----------|--------------------------------------------| | length | number | Length of the output string | | withTimestamp | boolean | Whether to append a timestamp | | separator | string | Separator between string and timestamp | | charset | string | Characters to randomly pick from |

Other Helpers

  • rsgUtilShort(withTimestamp?, separator?)
  • rsgUtilHex(length?, withTimestamp?, separator?)
  • rsgUtilUUID()

🖥️ CLI Usage

You can also use rsg-util from the terminal:

npx rsg-util [options]

Available Flags

| Flag | Alias | Description | |-----------------|-------|----------------------------------------| | --length | -l | Length of the string | | --timestamp | -t | Append timestamp | | --separator | -s | Custom separator for timestamp | | --charset | -c | Custom character set | | --copy | | Copy result to clipboard | | --uuid | | Generate a UUID v4 | | --interactive | -i | Launch interactive mode |


Examples

# Default 10-character string
npx rsg-util

# 16 characters, timestamp, dash separator
npx rsg-util --length=16 --timestamp --separator=-

# Custom charset
npx rsg-util --length=6 --charset=ABC123

# UUID mode
npx rsg-util --uuid

# Interactive mode
npx rsg-util --interactive

npm license downloads

📄 License

This project is licensed under the MIT License.