A utility for calculating size and managing node_modules directory.
This program allows you to:
- Check if node_modules directory exists
- Calculate the total size of node_modules directory
- Optionally delete the node_modules directory
go run main.go- Go 1.24 or higher
- Multi-threaded file size calculation
- Atomic operations for safe parallel execution
- Recursive directory traversal
go build -o npklgo build -ldflags="-w -s" -o npklFlags explanation:
-w: Disables DWARF generation (debug information)-s: Disables symbol table generation These flags help reduce the executable size.
For Windows (PowerShell):
$env:GOOS="windows"; $env:GOARCH="amd64"; go build -ldflags="-w -s" -o npkl.exeFor Windows (CMD):
set GOOS=windows && set GOARCH=amd64 && go build -ldflags="-w -s" -o npkl.exeFor Linux/macOS (Bash):
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o npkl # For Linux
GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o npkl # For macOS