Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Files.walkWithAttributes #3390

Merged
merged 2 commits into from
Mar 1, 2024
Merged

Add Files.walkWithAttributes #3390

merged 2 commits into from
Mar 1, 2024

Conversation

mpilquist
Copy link
Member

@mpilquist mpilquist commented Feb 17, 2024

This provides better performance than Files[F].walk(path).evalMap(p => p -> Files[F].getBasicFileAttributes(p)) given that all implementations of walk use file attributes.

Some use cases:

Computing cumulative size of a tree:

Files[F].walkWithAttributes(path).map(_.attributes.size).compile.foldMonoid

Getting all directories in a tree:

Files[F].walkWithAttributes(path).filter(_.attributes.isDirectory)

@mpilquist mpilquist merged commit 5b18a37 into main Mar 1, 2024
31 checks passed
@mpilquist mpilquist deleted the topic/walk-with-attributes branch March 1, 2024 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant