gravityfile-scan
The directory scanner behind gravityfile, plus readers and writers for saved scans.
This crate exists for the grav binary and its sibling crates. Its API
follows their needs and can change in any minor release.
JwalkScannerwalks a directory in parallel and builds agravityfile_core::FileTree. Sizes are allocated blocks by default or apparent lengths on request, hard links count once, and a directory's size covers its whole subtree even when a depth limit drops its children. Unreadable entries become warnings instead of errors. Progress is broadcast to subscribers, and aCancellationTokenstops the scan.snapshot::readopens a saved scan: agrav exportsnapshot or anncdu -o/gdu -odump, either optionally zstd-compressed.ncdu::writewrites a tree as an ncdu dump, soncdu -fcan browse it. Both ncdu directions stream and handle names that are not UTF-8.quick_listlists one directory without descending, for interactive use.
use ;
use ;
use CancellationToken;
let dir = tempdir?;
write?;
let mut config = new;
config.apparent_size = true;
let tree = new.scan?;
assert_eq!;
assert_eq!;
let mut dump = Vecnew;
write?;
let options = ImportOptions ;
let restored = read_from?;
assert_eq!;
# Ok::
Licence
MIT or Apache-2.0, at your option.