fs.readdir()

The Node.js function that lists the entries of a directory, optionally with their types and optionally including every subdirectory.

In more detail

With { withFileTypes: true } it returns Dirent objects that already know whether each entry is a file or a directory. With { recursive: true } it walks the whole tree in one call.

Related terms

Taught in

References