Skip to main content
Version: Next

readDir

function readDir(path): AsyncIterable<DirEntry>;

Read a directory with async iterator.

Parameters​

ParameterTypeDescription

path

string

Directory path to read.

Returns​

AsyncIterable<DirEntry>

Async iterator.

Throws​

Throws TypeError if the path is invalid. Or throws Error if failed to read the directory.

Example​

for await (const entry of Rsvim.fs.readDir(".")) {
Rsvim.cmd.echo(entry.name);
}