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

nv-random-dir

v1.0.0

Published

A tool for generating realistic random directory structures to benchmark and test filesystem performance.

Readme

Random Filesystem Generator

A tool for generating realistic random directory structures to benchmark and test filesystem performance.

Purpose

This tool creates random directory trees with realistic Linux-style naming patterns and diverse file types. It's designed primarily for filesystem performance testing - allowing you to quickly generate large, complex directory structures to measure:

  • Directory traversal speed
  • File creation/deletion performance
  • Metadata operations
  • Search and indexing efficiency
  • Backup/sync tool performance
  • Filesystem driver benchmarks

Installation

npm install nv-random-dir

Usage

const rand_mkdir = require('nv-random-dir');

// Generate a random directory tree
const path = rand_mkdir('./workspace');

console.log(`Test filesystem created at: ${path}`);
// => Test filesystem created at: ./workspace/rand_dir1709251234567890123

Features

  • Realistic Structure: Generates directory trees based on real Linux filesystem patterns
  • Diverse File Types: Creates files with 100+ common extensions (.js, .py, .jpg, .mp4, .zip, etc.)
  • Unique Names: Uses Linux-style naming (tmp, usr-local, lib-cfg, var-log, etc.)
  • Variable Depth: Random tree depth and branching for realistic complexity
  • Fast Generation: Creates complex structures in milliseconds

Example Output

workspace/rand_dir1709251234567890/
├── tmp-cache/
│   ├── app.js
│   ├── data.json
│   └── image.png
├── usr-local/
│   ├── bin/
│   │   ├── main.cpp
│   │   └── utils.h
│   └── lib-pkg/
│       ├── module.so
│       └── config.yml
└── var-log/
    ├── error.log
    └── debug.txt

API

rand_mkdir(workdir = './')

Creates a random directory structure in the specified working directory.

Parameters:

  • workdir (string): Base directory where the random tree will be created. Defaults to './'

Returns:

  • (string): Full path to the created root directory

Throws:

  • Error if workdir doesn't exist

Example:

try {
    const testDir = rand_mkdir('/tmp');
    console.log(`Created test structure: ${testDir}`);
    
    // Run your filesystem benchmarks here...
    
} catch (error) {
    console.error('Failed to create structure:', error.message);
}

File Extensions Supported

The generator includes 100+ file extensions across multiple categories:

  • Programming: .js, .ts, .py, .go, .rs, .java, .cpp, .c
  • Web: .html, .css, .scss, .vue, .jsx, .svg
  • Images: .jpg, .png, .gif, .webp, .ico, .psd
  • Video: .mp4, .avi, .mkv, .mov, .webm
  • Audio: .mp3, .wav, .flac, .aac, .ogg
  • Archives: .zip, .tar, .gz, .7z, .rar
  • Documents: .txt, .md, .pdf, .doc, .csv
  • Config: .yml, .json, .toml, .env, .xml
  • Databases: .db, .sqlite, .sql

Use Cases

Filesystem Performance Testing

const rand_mkdir = require('nv-random-dir');
const { performance } = require('perf_hooks');

// Create test structure
const testDir = rand_mkdir('./benchmark');

// Test directory traversal speed
const start = performance.now();
// ... your filesystem operations ...
const end = performance.now();

console.log(`Operation took ${end - start}ms`);

Benchmarking Examples

  • Directory walking: Test recursive directory traversal algorithms
  • Search operations: Measure file search and filtering performance
  • Bulk operations: Test mass file creation, copy, move, or delete
  • Indexing: Benchmark file indexing and metadata extraction
  • Compression: Test archiving tools on diverse file structures
  • Sync tools: Measure rsync, rclone, or backup tool performance

License

ANY