Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pragdave/dir_walker
Simple Elixir file-system directory tree walker. It can handle large filesystems, as the tree is traversed lazily.
https://github.com/pragdave/dir_walker
Last synced: 2 months ago
JSON representation
Simple Elixir file-system directory tree walker. It can handle large filesystems, as the tree is traversed lazily.
- Host: GitHub
- URL: https://github.com/pragdave/dir_walker
- Owner: pragdave
- Created: 2014-09-18T00:37:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-01-08T17:28:38.000Z (about 4 years ago)
- Last Synced: 2024-10-13T15:42:03.100Z (3 months ago)
- Language: Elixir
- Size: 38.1 KB
- Stars: 41
- Watchers: 5
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - DirWalker lazily traverses one or more directory trees, depth first, returning successive file names. (Files and Directories)
- fucking-awesome-elixir - dir_walker - DirWalker lazily traverses one or more directory trees, depth first, returning successive file names. (Files and Directories)
- awesome-elixir - dir_walker - DirWalker lazily traverses one or more directory trees, depth first, returning successive file names. (Files and Directories)
README
DirWalker
=========DirWalker lazily traverses one or more directory trees, depth first,
returning successive file names.Initialize the walker using
```elixir
{:ok, walker} = DirWalker.start_link(path, [, options ]) # or [path, path...]
```Then return the next `n` path names using
```elixir
paths = DirWalker.next(walker [, n \\ 1])
```Successive calls to `next` will return successive file names, until
all file names have been returned.These methods have also been wrapped into a Stream resource.
```elixir
paths = DirWalker.stream(path [, options]) # or [path,path...]
```By default DirWalker will follow any symlinks found. With the `include_stat`
option, it will instead simply return the `File.Stat` of the symlink
and it is up to the calling code to handle symlinks.`options` is a map containing zero or more of:
* `include_stat: true`
Return tuples containing both the file name and the `File.Stat`
structure for each file. This does not incur a performance penalty
but obviously can use more memory. When this option is specified,
DirWalker will not follow symlinks.* `include_dir_names: true`
Include the names of directories that are traversed (normally just the names
of regular files are returned). Note that the order is such that directory names
will typically be returned after the names of files in those directories.* `matching:` _regex_
Only file names matching the regex will be returned. Does not affect
directory traversals.