0.5.4 • Published 3 months ago

disk-management v0.5.4

Weekly downloads
2
License
MIT
Repository
github
Last release
3 months ago

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?)

ParameterTypeDescriptionDefault Value
directorystringPath to root directory you want scan__dirname of this module (most case it has value: ./node_modules/disk-management)
thresholdnumberMinimum number(Bytes) you want application filter your child folder1000000
modeScanModeScanMode Mode you want scanScanMode.Normal

Compare

Compare(threshold?, pathToSourceFile?, pathToTargetFile?)

ParameterTypeDescriptionDefault Value
thresholdnumberMinimum file size changed of each File same position1000000
pathToSourceFilestringPath to source file you want compare with target file2nd from last in scan dir
pathToTargetFilestringPath to target file you want compare1nd 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

0.5.4

3 months ago

0.5.3

3 months ago

0.5.2

3 months ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago