フォルダの中にどれだけのファイルが入っているか確認したことはあるでしょうか。ストレージが大容量化する中で、つい何でもかんでも放り込んでしまって、忘れているかも知れません。 プロジェクトにおいてどういったファイルがあって、どれくらいの割合になっているか知りたい時にはHMSCを使ってみましょう。

HMSCの使い方

実行例です。パスを与えるだけでOKです。npxを使えばインストールも不要です。

$ npx hmsc --path /path/to/dir

? 1 folder;
? 1878 line in 25 file;
Total size of files: 0.41809082 MB

5 file extensions: .DS_Store .html .css .png .jpg;
1 line (0.05% of total lines) on 1 .DS_Store file (4.00% of all files), Size: 0.00586319 MB (1.40% of total size)
155 line (8.25% of total lines) on 1 .html file (4.00% of all files), Size: 0.00524330 MB (1.25% of total size)
105 line (5.59% of total lines) on 2 .css file (8.00% of all files), Size: 0.00149441 MB (0.36% of total size)
77 line (4.10% of total lines) on 4 .jpg file (16.00% of all files), Size: 0.01898193 MB (4.54% of total size)
1540 line (82.00% of total lines) on 17 .png file (68.00% of all files), Size: 0.38650799 MB (92.45% of total size)
⭐ inside /path/to/dir

–tableで表示が一覧になります。

$ npx hmsc --path /path/to/dir --table

? 1 folder;
? 1878 line in 25 file;
Total size of files: 0.41809082 MB

5 file extensions: .DS_Store .html .css .png .jpg;

┌────────────────┬──────────────────────────┬────────────────────────────┬─────────────────────────────────────┐
│ File extension │           Count of files │                 Line Count │                                Size │
├────────────────┼──────────────────────────┼────────────────────────────┼─────────────────────────────────────┤
│      .DS_Store │   1 (4.00% of all files) │     1 (0.05% of all lines) │  0.00586319MB (1.40% of total size) │
│          .html │   1 (4.00% of all files) │   155 (8.25% of all lines) │  0.00524330MB (1.25% of total size) │
│           .css │   2 (8.00% of all files) │   105 (5.59% of all lines) │  0.00149441MB (0.36% of total size) │
│           .jpg │  4 (16.00% of all files) │    77 (4.10% of all lines) │  0.01898193MB (4.54% of total size) │
│           .png │ 17 (68.00% of all files) │ 1540 (82.00% of all lines) │ 0.38650799MB (92.45% of total size) │
└────────────────┴──────────────────────────┴────────────────────────────┴─────────────────────────────────────┘

⭐ inside /path/to/dir

HMSCはGitHubのWebサイトで見られるような、どれくらいのファイルが存在するのか知るのに役立ちます。ファイル数、行数、サイズなど3つの情報でプロジェクト構成が可視化されるのが便利なポイントでしょう。

HMSCはJavaScript製のオープンソース・ソフトウェア(MIT License)です。

Abdullah-V/HMSC: HMSC (How Much Stuffs CLI) analyst for your files and folders