OxL Reference

method fs.list

Entries of a directory sorted by name (. and .. are not listed).

Example:

oxl✓ checked in CI
use std.io { File, fs }

fn main() io {
  let dir = fs.tempDir()!
  File.writeText("{dir}/a", "")!
  File.writeText("{dir}/b", "")!
  print("{fs.list(dir)!.len()}")
  fs.removeAll(dir)!
}
Output
2
pub(api) static fn list(path: str) -> List<DirEntry> | IoError  io

Since. 1.0.0-beta

Parameters

NameType
pathstr

Returns

List<DirEntry>

Errors

Effects

io

Defined in: std/io/io.oxl:635

See also