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

disk-tools

v1.0.0

Published

Modular disk management tools

Readme

Disk Tools

A modular command-line tool for disk management operations including cleaning temporary directories, encrypted archiving, and remote synchronization.

Features

  • 🧹 Clean: Remove temporary directories (node_modules, target, .next, cache, etc.)
  • 🔒 Archive: Compress and encrypt directories with AES-256-GCM encryption
  • 🔄 Sync: Synchronize directories to remote locations using rsync

Installation

pnpm install

Usage

Development Mode

pnpm dev <command> [options]

Production Mode

# Build the project
pnpm build

# Run built version
pnpm start <command> [options]

Commands

🧹 Clean

Remove temporary directories from a path recursively.

Supported directory types:

  • node_modules - Node.js dependencies
  • target - Rust build output
  • .next - Next.js build cache
  • dist, build - Build output directories
  • .cache, cache - Cache directories
  • .turbo - Turbo cache
  • .nuxt, .output - Nuxt.js build files
  • .svelte-kit - SvelteKit build files
  • .vercel, .netlify - Deployment cache

Examples:

# Clean specific directory
pnpm dev clean /path/to/directory

# Dry run (preview without deleting)
pnpm dev clean /path/to/directory --dry-run

# Clean only specific directory names
pnpm dev clean /path/to/directory --custom node_modules target .next

Options:

  • -d, --dry-run - Preview what would be deleted without actually deleting
  • -c, --custom <dirs...> - Specify custom directory names to clean

🔒 Archive

Compress and encrypt directories for secure transfer using AES-256-GCM encryption.

Examples:

# Create encrypted archive
pnpm dev archive create /path/to/directory -o backup.zip.enc -p mypassword

# Extract encrypted archive
pnpm dev archive extract backup.zip.enc -o /path/to/extract -p mypassword

# Use default output path
pnpm dev archive create ./my-project -p securepass123

Create Options:

  • -o, --output <path> - Output archive path (default: archive.zip.enc)
  • -p, --password <password> - Encryption password (required)

Extract Options:

  • -o, --output <path> - Output directory path (default: ./extracted)
  • -p, --password <password> - Decryption password (required)

Security Notes:

  • Uses AES-256-GCM authenticated encryption
  • Generates random salt and IV for each archive
  • Password is derived using scrypt key derivation
  • Incorrect password will be detected during extraction

🔄 Sync

Synchronize directory to remote location using rsync.

Examples:

# Sync to remote server
pnpm dev sync /path/to/local [email protected]:/path/to/remote

# Sync with delete (mirror)
pnpm dev sync ./my-project user@server:/backup/my-project --delete

# Dry run to preview changes
pnpm dev sync ./data user@server:/data --dry-run

# Sync with exclusions
pnpm dev sync ./project user@server:/project -e node_modules -e "*.log" -e .git

# Verbose output
pnpm dev sync ./files user@server:/files --verbose

Options:

  • -d, --delete - Delete files in destination that don't exist in source
  • --dry-run - Preview what would be transferred without actually syncing
  • -e, --exclude <patterns...> - Exclude patterns (e.g., "*.log" "node_modules")
  • -v, --verbose - Show detailed output

Requirements:

  • rsync must be installed on your system
  • SSH access to remote server (if syncing remotely)

Project Structure

disk-tools/
├── src/
│   ├── commands/         # Command modules
│   │   ├── clean.ts      # Clean command implementation
│   │   ├── archive.ts    # Archive command implementation
│   │   └── sync.ts       # Sync command implementation
│   ├── utils/            # Shared utilities
│   │   └── logger.ts     # Logging and UI utilities
│   └── index.ts          # CLI entry point
├── package.json
├── tsconfig.json
└── README.md

Architecture

This tool is designed with modularity in mind:

  • Modular Commands: Each command is implemented as a separate module
  • Easy Extension: Add new commands by creating a new file in src/commands/
  • Commander.js: Uses Commander.js for robust CLI argument parsing
  • TypeScript: Full type safety and modern JavaScript features

Adding New Commands

To add a new command:

  1. Create a new file in src/commands/your-command.ts
  2. Implement your command logic
  3. Export a registerYourCommand(program: Command) function
  4. Register it in src/index.ts

Example:

import { Command } from 'commander';
import { logger } from '../utils/logger.js';

export function registerYourCommand(program: Command): void {
  program
    .command('your-command')
    .description('Your command description')
    .argument('<path>', 'Path argument')
    .option('-o, --option', 'Option description')
    .action(async (path: string, options: any) => {
      logger.info('Executing your command...');
      // Your implementation here
    });
}

License

MIT