• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Discover surprisingly large directories from the command line.

Space Hogs Build Status

Discover surprisingly large directories from the command line.

~/projects/npm $ space-hogs
151 MB ~/projects/npm
Largest children directories, each larger than 9 MB
β”œβ”€β”€  31 MB [β–’   ] /.git
β”œβ”€β”€   9 MB [β–’   ] /node_modules/npm-registry-couchapp/node_modules
β”œβ”€β”€  12 MB [β–’   ] /node_modules/tap/node_modules/nyc/node_modules
β”œβ”€β”€  20 MB [β–’   ] /node_modules/standard/node_modules/standard-engine/node_modules/eslint/node_modules
β”œβ”€β”€  17 MB [β–’   ] /node_modules/standard/node_modules/standard-format/node_modules/esformatter-jsx/node_modules/babel-core/node_modules
└──  62 MB [β–’β–’  ] (everything else)
    151 MB Total
~/projects/npm $ space-hogs node_modules 5 --depth=0
114 MB ~/projects/npm/node_modules
Largest children directories, each larger than 5 MB
β”œβ”€β”€   6 MB [β–’   ] /node-gyp
β”œβ”€β”€  11 MB [β–’   ] /npm-registry-couchapp
β”œβ”€β”€  27 MB [β–’   ] /tap
β”œβ”€β”€  56 MB [β–’β–’  ] /standard
└──  13 MB [β–’   ] (everything else)
    114 MB Total

Install

$ npm i -g space-hogs

Usage

$ space-hogs --help

    Usage
      space-hogs [path] [size] [--depth=number]

    Options
      directory        Directory to scan. Defaults to the current directory.
      size             Minimum size in MB. Defaults to 6% of the total MB.
      --depth=number   Number of sub-directories to dive into. 0 = none. Defaults to all.

    Examples

      $ space-hogs
      $ space-hogs node_modules 5 --depth=0
      $ space-hogs 1000

Tips

  • I don't recommend using this on the root of your drive, there are better tools for exploring your entire disk.
  • There isn't a real API yet, it will always output to the console, but I hope to have a promise-based API.
  • Test coverage isn't really there yet.

Contributions

I'm happy to take contributions.

Here's some ideas:

Colors

  • Show me what it should look like, or make a PR using chalk.
  • Even though all terminals should have a black background, some people use white, and we should be attentive to that when picking colors.

API + Refactoring

  • I feel that my recursive promise implementation could be done better with observables/RxJS.
  • I think this will make it possible to have a good API.
  • If this doesn't make sense it's probably because I don't know enough about observables/RxJS.

Cross-platform (aka Windows support)

  • I currently use du for calculating disk usage. This won't work in Windows.
  • If you would like to help make it work in Windows let me know and start working on a pull request.

Performance

  • I wonder if there are faster ways to get disk usage than du using native code. Ideas?

Test Coverage

  • This project uses the AVA test runner, I recommend trying it!
  • Help me improve the coverage.

Troubleshooting

  • This is meant for projects, not for checking your entire disk, or even all of /usr/.
  • Add --debug and to get some debug info that will be helpful for creating tickets.
  • Windows is not yet supported
  • Versions of node before 4 are not supported.

Inspiration

Super awesome and prolific node module creator Sindre Sorhus has a repo for sharing ideas for new modules. On Feb 10, 2016, I submitted a proposal for space-hogs: cli for discovering surprisingly large directories. There was a lot of interest, but nobody else created it, so I decided to see if I could.

Similar Tools

  • ndu - Generates a web page with an ordinal graph showing how much space node modules take up.
  • WinDirStat - Windows only, GUI only, shows every directory, not just the largest offenders.
  • Grand Perspective - Mac only, GUI only, shows every directory, not just the largest offenders.

About the Author

Hi! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower. @dylang

License

MIT Β© Dylan Greene

More Repositories

1

npm-check

Check for outdated, incorrect, and unused dependencies.
JavaScript
6,553
star
2

shortid

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.
JavaScript
5,736
star
3

node-rss

RSS feed generator for Node.
JavaScript
995
star
4

grunt-notify

Automatic Notifications when Grunt tasks fail.
JavaScript
921
star
5

grunt-prompt

Add interactive UI to your Gruntfile such as lists, checkboxes, text input with filtering, and password fields, all on the command line.
JavaScript
368
star
6

observatory

Beautiful UI for showing tasks running on the command line.
JavaScript
276
star
7

node-xml

Fast and simple Javascript-based XML generator/builder for Node projects.
JavaScript
274
star
8

changelog

Finally see what's changed when you do npm update. Changelog generates a changelog for npm modules and github repos.
JavaScript
239
star
9

opowerjobs

Node.js site using Express and Connect.
JavaScript
61
star
10

logging

Lightweight informative modern console logging.
JavaScript
54
star
11

anthology

List of modules for any npm user, plus number of downloads and github stars.
JavaScript
46
star
12

captionbot

Get captions for image using Microsoft's CaptionBot
JavaScript
41
star
13

grunt-attention

Display attention-grabbing messages in the terminal.
JavaScript
26
star
14

jira-improved

Improves the Jira Agile board by showing the Epic name in the cards and hiding the Done column if you use a quick filter to hide tickets in that column.
JavaScript
24
star
15

node-atom

DEPRECATED - NOT MAINTAINED
JavaScript
20
star
16

what-dog

Get the breed of a dog from an image using Microsoft's what-dog
JavaScript
15
star
17

grunt-cat

Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi.
JavaScript
14
star
18

random-puppy

Get a random puppy image url.
JavaScript
13
star
19

jobvite

DEPRECATED ----- Jobvite API for Node
JavaScript
12
star
20

source-map-diff

Compare source maps with cli and web output
TypeScript
7
star
21

flowdock-refined

DEPRECATED - Flowdock desktop app custom UI
CSS
5
star
22

...

really, this is a valid project name?
2
star
23

dotfiles

Vim Script
2
star
24

lean

Simple in-memory data store to lean on. Helpful when you don't need a couch.
JavaScript
2
star
25

jquery-tooltips

Easy to use image-free HTML5 tooltips for jQuery 1.5.2+.
JavaScript
2
star
26

grunt-templates-dylang

Templates for grunt-readme that dylang will be using across multiple projects.
JavaScript
1
star
27

dotconfig

My custom terminal colors, bash-it prompt, intellij and webstorm settings, etc
Shell
1
star
28

dylang.github.com

Everything you need to know about me.
1
star