Documentation
¶
Overview ¶
Command checksum hashes every file under a directory, several files at a time.
go run ./examples/checksum [dir]
It is the counterpart to the tracking example. That one has a slice of inputs known up front, so Map fits. Here the input is a directory walk: the file count is unknown, the list could be huge, and there is no reason to wait for the walk to finish before hashing anything. That is what Stream is for.
The interesting part is files(), which turns filepath.WalkDir into an iter.Seq[string]. Writing a sequence is the one thing callers of this package usually have to do themselves, and the rule is short: stop walking as soon as yield returns false.
Click to show internal directories.
Click to hide internal directories.