Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment files

fs/dir::files


Inputs

⇥ filesystem: Block<FileSystem> (fs/filesystem::FileSystem)
⇥ path: Block<string>

Outputs

↦ completed: Block<void>
↦ error: Block<string>
↦ failed: Block<void>
↦ files: Stream<string>
↦ finished: Block<void>


List the files of a directory.

The files under the directory path of filesystem, at any depth, are given through files, as paths relative to path separated by /, sorted by name, a directory’s files coming where its name sorts. Only regular files are given: directories are walked, while links, never followed, and other entries (devices, sockets, pipes) are left out.

Once every file is given, completed is emitted. If path is not a directory or an entry cannot be read, failed is emitted and error contains the reason. finished is emitted in every case.

graph LR
     T("files()")
     F["〈🟨〉"] -->|filesystem| T
     P["〈🟨〉"] -->|path| T
     T -->|files| O["… a.txt sub/b.txt"]
     T -->|completed| C["〈🟩〉"]
     style F fill:#ffffff,stroke:#ffffff
     style P fill:#ffffff,stroke:#ffffff
     style O fill:#ffffff,stroke:#ffffff
     style C fill:#ffffff,stroke:#ffffff