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

mohyung

v0.1.0

Published

Snapshot and restore node_modules as a single SQLite file

Readme

mohyung

Snapshot and restore node_modules as a single SQLite file.

Why?

  • Single file backup: Manage as one .db file instead of tens of thousands of files
  • Fast restoration: Quick node_modules restoration with compression + deduplication
  • Version control friendly: SQLite format enables binary diff
  • Content-addressable: Identical files are stored only once (deduplication)

Installation

npm install -g mohyung
# or
pnpm add -g mohyung

Usage

pack - Snapshot node_modules into DB

mohyung pack [options]

Options:
  -s, --source <path>       node_modules path (default: "./node_modules")
  -o, --output <path>       output DB file path (default: "./node_modules.db")
  -c, --compression <level> compression level 1-9 (default: "6")
  --include-lockfile        include package-lock.json hash

Examples:

# Basic usage
mohyung pack

# Custom paths
mohyung pack -s ./my-project/node_modules -o ./backup.db

# Maximum compression
mohyung pack -c 9

unpack - Restore node_modules from DB

mohyung unpack [options]

Options:
  -i, --input <path>   input DB file path (default: "./node_modules.db")
  -o, --output <path>  output directory (default: "./node_modules")
  -f, --force          overwrite existing node_modules

Examples:

# Basic restoration
mohyung unpack

# Force overwrite
mohyung unpack -f

# Restore to different location
mohyung unpack -o ./restored_modules

status - Compare DB with current state

mohyung status [options]

Options:
  --db <path>               DB file path (default: "./node_modules.db")
  -n, --node-modules <path> node_modules path (default: "./node_modules")

Examples:

mohyung status

Output:

┌─ Status ─────────────────────────────┐
│ Unchanged: 12,345                    │
│ Modified: 3                          │
│ Only in DB: 1                        │
│                                      │
│ Modified files:                      │
│   M lodash/index.js                  │
│   M express/lib/router.js            │
└──────────────────────────────────────┘

DB Schema

┌─────────────────────────────────────────────────────────────┐
│                        SQLite DB                            │
├─────────────┬───────────────────────────────────────────────┤
│  metadata   │ created_at, node_version, schema_version, ... │
├─────────────┼───────────────────────────────────────────────┤
│  packages   │ id, name, version, path                       │
├─────────────┼───────────────────────────────────────────────┤
│  blobs      │ hash (PK), content (compressed), sizes        │
├─────────────┼───────────────────────────────────────────────┤
│  files      │ package_id, relative_path, blob_hash, mode    │
└─────────────┴───────────────────────────────────────────────┘

Content-addressable Storage:

  • Uses SHA-256 hash of file content as key
  • Identical files are stored only once
  • zlib compression for storage efficiency

Requirements

  • Node.js >= 18.0.0
  • Supports npm, yarn, and pnpm

Library Usage

import { pack, unpack, status, Store } from 'mohyung'

// Pack
await pack({
  source: './node_modules',
  output: './node_modules.db',
  compressionLevel: 6,
})

// Unpack
await unpack({
  input: './node_modules.db',
  output: './node_modules',
  force: true,
})

// Status
const result = await status({
  db: './node_modules.db',
  nodeModules: './node_modules',
})

console.log(result.unchanged, result.modified, result.onlyInDb)

Development

# Install dependencies
pnpm install

# Development mode (watch)
pnpm dev

# Build
pnpm build

# Test
pnpm test

# Type check
pnpm typecheck

License

MIT