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 🙏

© 2024 – Pkg Stats / Ryan Hefner

disk-management

v0.5.4

Published

Module/application for management your disk

Downloads

21

Readme

Latest Stable Version NPM Downloads NPM Downloads LICENSE

Disk management with Nodejs

Module/CLI application management storage your disk

Typescript code-base

Installation

npm install disk-management # Or yarn add disk-management

Table of Contents

CLI

We built-in with powerful cli command.

First thing first, disk-management will helpful when install as global module

Scan directory CLI

And now, you should be focus to first and most common task: Scan.

disk-management scan --root "C:\\" --threshold 1024

Command above will scan all file in "C:\\" and report all file size > 1024B (1KB). Special notice: Total storage value still equal total files. See in below example, value of directory contain 2 files still equal 3000 Bytes, but only file tsconfig.json will report to files for optimize file size

.
├── tsconfig.json (2000 Bytes)
└── yarn.lock (1000 Bytes)

Analyze disk CLI

After you using scan command, you will have demand for see overview all files and big files/folders e.g question for How much size of temporary folder? will have answer by this feature

disk-management analyze

? Choose source file (Use arrow keys)
> 2023-01-28_09.38.56.sys0.log.xjson
  2023-01-28_10.20.39.sys1.json.xjson
  2023-07-13_15.08.28.sys2.json.xjson
  2023-08-07_09.59.53.sys3.json.xjson
  2023-09-07_17.23.07.sys4.json.xjson
  2024-02-02_14.49.49.json.xjson
  2024-02-02_14.54.48.json.xjson

Importing

const DiskManagement = require('disk-management');

If you need micro function, import with ES6 systax

const { ScanMode, Scan, Compare } = require('disk-management');

API Usage

Base guide for application

Simple demo

Create 1 <file-name>.js, here we create file run.js

const { Scan, ScanMode } = require('disk-management');

Scan(__dirname, 10000, ScanMode.OnlyBigDirectory);

Or you need compare change in your disk

const { Compare } = require('disk-management');

Compare(10000);

Run application

node run.js

API References

Scan

Scan(directory?, threshold?, mode?)

| Parameter | Type | Description | Default Value | | --------- | -------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | | directory | string | Path to root directory you want scan | __dirname of this module (most case it has value: ./node_modules/disk-management) | | threshold | number | Minimum number(Bytes) you want application filter your child folder | 1000000 | | mode | ScanMode | ScanMode Mode you want scan | ScanMode.Normal |

Compare

Compare(threshold?, pathToSourceFile?, pathToTargetFile?)

| Parameter | Type | Description | Default Value | | ---------------- | ------ | ----------------------------------------------------- | ------------------------- | | threshold | number | Minimum file size changed of each File same position | 1000000 | | pathToSourceFile | string | Path to source file you want compare with target file | 2nd from last in scan dir | | pathToTargetFile | string | Path to target file you want compare | 1nd from last in scan dir |

ScanMode

Type: Enum

Values: Normal | OnlyBigDirectory

Description: In Normal mode, application will store all infomation of tree directory. Else with OnlyBigDirectory mode, application will store only folder with size of all file in that folder.

For example, you have folder with 3 file and 5 folder, we will calcute size of folder same as size of 3 file.

Development

NPM parameter

npm run run -- --version
npm run run -- scan -r "C:\\"

Issues

If you using npm version 5.6.0 or appear Not support version 10.15.x Cannot install ts-node-dev. Please upgrage to newest version npm

If using Apache for serve HTML result, notice with error related authz_core: ServerFault

License

MIT

Copyright (c) 2020, Giap Dong