@bobfrankston/tswalk
v1.1.23
Published
Fast TypeScript directory tree walker with file search, size analysis, and pattern matching
Maintainers
Readme
tswalk
Fast TypeScript directory tree walker with file search, size analysis, pattern matching, and resumable checkpointing.
Install
npm install -g @bobfrankston/tswalkUsage
tswalk [path] [depth] [options]- path - Directory to analyze (default: current directory)
- depth - Display depth, or
n/mfor display/checkpoint depth (default: 1)
Options
| Flag | Description |
|------|-------------|
| -d, -depth | Set depth: n or n/m (checkpoint defaults to n+1) |
| -display | Show saved .tswalk.json without scanning |
| -threshold | Minimum size in MB/GB to show a directory |
| -mb | Show sizes in megabytes (default) |
| -gb | Show sizes in gigabytes |
| -c | Show compressed sizes (Windows only) |
| -l, -links | Follow symbolic links and junctions |
| -nt | Don't show link targets |
| -t, -target | Show link targets |
| -f pattern | Find files matching pattern (;-separated, globs or /regex/) |
| -cmd "cmd" | Run command in each directory |
| -nr | Disable checkpointing entirely |
| -restart | Discard existing checkpoint and start fresh |
| -v | Verbose output (show all errors) |
| -q | Quiet mode (minimal output) |
| --version | Show version number |
Checkpointing
Scans are checkpointed to .tswalk.json in the target directory by default. This enables:
- Resume on interrupt - Ctrl+C saves progress; restarting picks up where it left off
- Post-analysis - Completed checkpoints are kept as a richer-than-console record
- Depth splitting - Use
-d n/mto display at depth n but log to depth m in the checkpoint
Checkpoints older than 24 hours are discarded automatically. Use -display to view a saved checkpoint without rescanning.
Checkpoint structure
{
"header": { "status": "completed", "startedAt": "...", "rootPath": "..." },
"totals": { "size": 123456, "dirs": 100, "files": 5000 },
"tree": {
"name": "root",
"children": [
{ "name": "subdir", "size": 1000, "totalDirs": 5, "totalFiles": 50, "children": [] }
]
}
}Each node stores its name relative to its parent. The tree depth is controlled by the log depth (m in -d n/m).
Examples
tswalk . # Analyze current directory
tswalk /path 3 # Show 3 levels deep
tswalk /path -d 2/5 -gb # Show 2 deep, checkpoint 5 deep, sizes in GB
tswalk /path -threshold 100 # Show dirs > 100MB
tswalk . -f "*.ts;*.js" # Find TypeScript and JavaScript files
tswalk c:\ -display -d 3 # Show saved checkpoint at depth 3
tswalk c:\ -restart # Discard previous checkpoint, start fresh
tswalk . -nr # No checkpointingRepository
https://github.com/BobFrankston/tswalk
