Dirent
The object Node.js uses for one directory entry, with its name and methods such as isFile() and isDirectory().
In more detail
Its type information comes from reading the directory itself, so no extra stat call is needed per file. Call dirent.isFile(), isDirectory() or isSymbolicLink() to check the type, and use dirent.parentPath to build the full path.
Related terms
- fs.readdir() — The Node.js function that lists the entries of a directory, optionally with their types and optionally including every subdirectory.
- stat — The operating system call, and matching command, that reports a file's details such as size, mode and modification time without opening it.
Taught in
- Directory Traversal: Recursive Readdir & fs.watch — Node.js Internals & Backend Services