treemap-cli
Fast disk usage analysis from Rust or Python. On Windows NTFS drives it reads the Master File Table directly from the raw volume (the technique WizTree uses), so a whole drive is scanned in seconds instead of minutes. Everywhere else it falls back to a parallel directory walk. Results can be queried, exported (WizTree-style CSV, JSON) or rendered as a squarified treemap (SVG, or raw tiles for your own renderer).
pip install treemap-cli
No Rust toolchain needed: PyPI has prebuilt wheels for Windows (x64, arm64), Linux
(x86_64, aarch64, musl) and macOS (arm64, x86_64), each covering Python 3.9+. Prefer no
Python at all? Download the standalone treemap binary for your platform from the
GitHub Releases page (static
single-file executables, ~1 MB).
Rough timings for a full-drive scan (Administrator, MFT method):
| Drive | Entries | Time |
|---|---|---|
| SATA SSD, ~3.7 GiB MFT | ~3 M files | ~14 s (bound by disk read speed) |
| NVMe SSD, ~0.7 GiB MFT | ~0.6 M files | ~1.3 s |
| ~3 M-record MFT re-parsed from a dump file | ~3 M files | ~3 s |
Command line
> treemap scan C:\demo -n 5 --largest 3 --extensions 3
24 files, 19 folders scanned in 14.86s via mft
16.4 GiB 16.4 GiB C:\demo
3.9 GiB 3.9 GiB ##### 23.9% Videos\
3.1 GiB 3.1 GiB #### 19.1% backup.vhdx
3.1 GiB 3.1 GiB #### 18.8% Games\
2.2 GiB 2.2 GiB ### 13.3% Downloads\
1.7 GiB 1.7 GiB ## 10.6% Photos\
... 4 more
Largest files:
3.1 GiB C:\demo\backup.vhdx
2.5 GiB C:\demo\Games\SpaceSim\data.pak
1.9 GiB C:\demo\Videos\holiday-2025.mp4
Largest extensions:
3.1 GiB 1 files .vhdx
2.6 GiB 3 files .mp4
2.5 GiB 1 files .pak
> treemap scan C:\Users --depth 2 --svg users.svg --csv users.csv
> treemap scan ~/src --method walk # any OS / filesystem
> treemap dump-mft D: d.mft # snapshot the raw MFT ...
> treemap load-mft d.mft --root D:\ # ... and analyse it anywhere, later
Interactive browser
> treemap ui C: # scan, then browse
> treemap load-mft d.mft --ui # browse a saved MFT dump
treemap C:\demo
16.4 GiB size · 16.4 GiB allocated · 24 files · 19 folders · 100.0% of scan · mft in 14.35s
┌ Folder ─────────────────────────────────────────── by Size ┐┌ Treemap ───────────────────────────────────────────────────┐
│Size Share Files Modified Name ││▀▀▀▀▀▀▀▀▀▀▀▀▀▀backup.vhdx Games Downloads Projects │
│3.9 GiB ██▉ 23.9% 4 2026/10/15 Videos\ ││▌Videos ▐ │
│3.1 GiB ██▎ 19.1% 2026/10/15 backup.vh││▌ ▐ │
│3.1 GiB ██▎ 18.8% 3 2026/10/15 Games\ ││▌ ▐ │
│2.2 GiB █▋ 13.3% 3 2026/10/15 Downloads││▌ ▐ │
│1.7 GiB █▎ 10.6% 3 2026/10/15 Photos\ ││▌ ▐ Photos │
│1.7 GiB █▎ 10.2% 4 2026/10/15 Projects\││▌ ▐ │
│615.0 MiB ▌ 3.7% 2 2026/10/15 Music\ ││▌ ▐ Music │
│82.0 MiB 0.5% 3 2026/10/15 Documents││▌ ▐ │
│12.0 KiB 0.0% 2026/10/15 notes.txt││▄▄▄▄▄▄▄▄▄▄▄▄▄▄ │
└────────────────────────────────────────────────────────────┘└────────────────────────────────────────────────────────────┘
↑↓ move Enter open ⌫ up Tab view s sort a size/alloc t treemap o reveal ? help q quit
A sortable folder table beside a colour treemap of the current folder (each top-level
entry gets a hue; nested folders are shaded within it). Keys: arrows / hjkl to move and
drill in/out, Tab or 1 2 3 to switch between folder, largest-files and extension
views, s to change the sort, a to measure allocated bytes instead of size, t to hide
the treemap, o to reveal the selection in Explorer/Finder, r to rescan, ? for help.
The mouse works too: click a tile or row to select it, click it again (or double-click) to
open it, right-click to go up. (The examples above use a demo folder of placeholder files.
Scanning a folder via the MFT reads the whole volume's MFT, hence the time.)
From Python: tm.ui("C:"), or scan.ui() to browse a scan you already have.
The CLI is also available as a standalone Rust binary (cargo install --path crates/treemap-cli).
Python
import treemap_cli as tm
scan = tm.scan("C:") # method="auto" | "mft" | "walk"
print(scan) # <Scan "C:\\" 1204311 files, 230118 dirs, 210.4 GiB via mft in 6.1s>
for e in scan.root.children()[:10]: # largest first
print(f"{tm.human_bytes(e.size):>10} {e.name}")
users = scan["C:\\Users"] # case-insensitive lookup
scan.largest_files(20, under="C:\\Users")
scan.extensions(10) # [{'extension': 'dll', 'size': ..., 'files': ...}, ...]
# squarified treemap tiles for your own renderer: (entry, x, y, w, h, depth)
tiles = scan.treemap(1920, 1080, max_depth=3)
scan.to_svg("c.svg", 1920, 1080)
scan.to_csv("c.csv") # WizTree column layout
import pandas as pd
df = pd.DataFrame(scan.rows(), columns=["path", "size", "allocated", "modified", "is_dir", "files", "dirs"])
Scans release the GIL; the result is an immutable Rust tree, so Entry objects are
cheap views and millions of entries do not become millions of Python objects until you ask.
How it works
FSCTL_GET_NTFS_VOLUME_DATAon\\.\C:gives cluster size, record size and the valid length of the MFT;FSCTL_GET_RETRIEVAL_POINTERSonC:\$MFTgives its physical extents (falling back to decoding record 0's own runlist).- The extents are read with unbuffered (
FILE_FLAG_NO_BUFFERING) sequential I/O, several requests in flight, while a rayon pool applies update-sequence fixups and parses records in parallel. - Per record:
$STANDARD_INFORMATION(mtime, attributes),$FILE_NAME(parent + name, skipping DOS 8.3 aliases; several names = hard links),$DATA(unnamed stream size; every stream's allocated clusters) and$INDEX_ALLOCATION. Extension records are merged into their base record. - Parent references link records into a tree; sizes roll up bottom-up.
Reading the raw volume needs Administrator rights. Without them (or on non-NTFS
volumes, network shares, Linux, macOS) method="auto" walks directories in parallel
instead and reports why in scan.fallback_reason.
Size semantics
- size – logical length of the unnamed data stream (what Explorer shows).
- allocated – clusters actually in use × cluster size, over all streams (alternate
data streams,
WofCompressedData, …). Sparse and compressed files count only their real clusters; files small enough to live inside the MFT record count 0. - Hard links are counted once by default, so totals match the space really used on
disk. Pass
hardlinks="each"/--hardlinks eachto count every link (WizTree's and Explorer's behaviour). - Directory index blocks (
$INDEX_ALLOCATION) are included in a folder's allocated size.
Verified on a live C: drive: total allocated was within 0.15% of the volume's used space reported by Windows.
Development
uv venv && uv pip install maturin pytest
maturin develop --release
pytest
cargo test --workspace
Release: push a v* tag; .github/workflows/release.yml builds abi3 wheels for
Windows (x64, arm64), Linux (x86_64, aarch64, musl) and macOS (arm64, x86_64), plus an
sdist, and publishes them with PyPI trusted publishing.
Notes
The NTFS parsing is implemented from public NTFS documentation.
Metadata
Release files for treemap-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| treemap_cli-0.1.0.tar.gz | 68.2 kB | With provenance | Details for treemap_cli-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 5.5 MB
Release files / treemap_cli-0.1.0.tar.gz
| Download URL | treemap_cli-0.1.0.tar.gz |
|---|---|
| Size | 68.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7b6b0d5783286b8ee4d0c9c36f53121ef4268775a27e788c213e573323247d8
|
|
BLAKE2b-256 checksum How to use checksums |
1ce5d2a6248bd32d74328eaec8e2bdc9d32e06f9a4a910778db9a6a502b1437e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-win_arm64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 682.0 kB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
77297e77765cc01ba8367340dbbe066d0812017e10de9636265cbafaae3b73d3
|
|
BLAKE2b-256 checksum How to use checksums |
0815ef376acac4d6743d039fd66f7231a0e06f718d9f470788deba0d208f6210
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-win_amd64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 715.5 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d521907454f5825b9f393557d311b56bdf774f934c77592fb3e27ca4e78b9767
|
|
BLAKE2b-256 checksum How to use checksums |
79afb1653402ca9dbe9ea27e1c9def45ef6925beb8175da4ff58094884307311
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0a8ac29d2f3f60b78fdbc1789826a8f1381097408630d2621e95981b09e41449
|
|
BLAKE2b-256 checksum How to use checksums |
35b12180dfa1ce59fbb4e992678e9db8a2d01b35be78a4afd90bf3ed300ae269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 791.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3277391c3c176b2f81532fedde06eec11847a9198321555f73cd1da3f507b937
|
|
BLAKE2b-256 checksum How to use checksums |
7135542992e077f2a58c334336835418f5b5e867be31992b3b0c23867e2e6669
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 755.1 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
956d24249f4f270da2d93fb3a88e1c5a2556f19251127c2d8090dde2dc38dc0a
|
|
BLAKE2b-256 checksum How to use checksums |
47a3f1ec410725863ef55fad2bb889b045a5f66af8e9b68c70516c0d5eab11cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 705.5 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5f2cb6a54b12cc8b1d0150a7c67590dc13a30403734a693ed5eabbc802ddf1eb
|
|
BLAKE2b-256 checksum How to use checksums |
7eb7a45ea261722badc86ed73a016597872ebd19d6142f446c529fd24fbafc38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / treemap_cli-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | treemap_cli-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 749.7 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b9858373d41953194754530d6bb4507382a1ea1fb19ec41bc863b0d2ddc56677
|
|
BLAKE2b-256 checksum How to use checksums |
22daf40b54ebe72fe63bf853f7322aec2d7e1553033081a70d27a03df2396161
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logSecurity for treemap-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for treemap_cli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.