Module fs/walker

fs/walker

Recursive directory traversal.

Example

{ walk, WalkEntry } :: import "std/fs/walker";

main :: (fn(io : Io, exn : Exception) -> unit)({
  entries := io.await(walk(Path.new(`/tmp`), io), { io, exn });
  i := usize(0);
  while runtime((i < entries.len())), {
    e := entries(i);
    println(e.path);
    i = (i + usize(1));
  };
});

Types

WalkEntry struct
WalkEntry

Entry returned by the directory walker.

Fields

NameTypeDescription
pathPath
nameString
depthu32
file_typeFileType
WalkOptions struct
WalkOptions

Options controlling directory walk behavior.

Fields

NameTypeDescription
max_depthOption(u32)
follow_symlinksbool
include_dirsbool
impl(WalkOptions, ...)
defaults : (WalkOptions) fn() -> WalkOptions

Returns: WalkOptions

Functions

walk function
fn(root : Path, io : Io) -> Impl(Future(ArrayList(WalkEntry), IoExn))

Walk a directory tree with default options.

Parameters

NameTypeNotes
rootPath
ioIo

Returns: Impl(Future(ArrayList(WalkEntry), IoExn))

walk_cstr function
fn(root : *(u8), io : Io) -> Impl(Future(ArrayList(WalkEntry), IoExn))

Parameters

NameTypeNotes
root*(u8)
ioIo

Returns: Impl(Future(ArrayList(WalkEntry), IoExn))

walk_with function
fn(root : Path, options : WalkOptions, io : Io) -> Impl(Future(ArrayList(WalkEntry), IoExn))

Parameters

NameTypeNotes
rootPath
optionsWalkOptions
ioIo

Returns: Impl(Future(ArrayList(WalkEntry), IoExn))

walk_with_cstr function
fn(root : *(u8), options : WalkOptions, io : Io) -> Impl(Future(ArrayList(WalkEntry), IoExn))

Parameters

NameTypeNotes
root*(u8)
optionsWalkOptions
ioIo

Returns: Impl(Future(ArrayList(WalkEntry), IoExn))