https://github.com/cdaringe/fswalk
recursively walk the filesystem
https://github.com/cdaringe/fswalk
Last synced: 4 months ago
JSON representation
recursively walk the filesystem
- Host: GitHub
- URL: https://github.com/cdaringe/fswalk
- Owner: cdaringe
- Created: 2024-01-18T01:54:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-13T05:32:01.000Z (6 months ago)
- Last Synced: 2025-12-14T19:28:10.446Z (6 months ago)
- Language: Gleam
- Size: 23.4 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# fswalk
Recursively walk the filesystem starting from the provided path.
[](https://hex.pm/packages/fswalk)
[](https://hexdocs.pm/fswalk/)
```sh
gleam add fswalk
```
```gleam
import fswalk
import gleam/yielder
pub fn main() {
fswalk.builder()
|> fswalk.with_path("test/fixture")
|> fswalk.with_traversal_filter(fn(entry) {
!string.contains(does: entry.filename, contain: "ignore_folder")
})
|> fswalk.walk
|> yielder.fold([], fn(acc, it) {
case it {
Ok(entry) if !entry.stat.is_directory -> [entry.filename, ..acc]
_ -> acc
}
})
|> should.equal(["test/fixture/b/c/d", "test/fixture/a"])
}
```
Further documentation can be found at .
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```
## changelog
- 1.0.0 - init
- 2.0.0 - support traverse filtering in tandem with entry filtering
- 3.0.0
- dropped `.with_entry_filter`. Use `iterator.*` functions on the output instead.
- dropped sugar functions `.map/.each/.fold`. Use `iterator.*` functions on the output instead.
- 3.0.3
- Use `yielder.*` functions on the output instead of `iterator.*`