diff --git a/doc/api/fs.md b/doc/api/fs.md index 57aabee7035fe7..4c00885117e4ca 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -283,6 +283,92 @@ synchronous use libuv's threadpool, which can have surprising and negative performance implications for some applications. See the [`UV_THREADPOOL_SIZE`][] documentation for more information. +## Class: fs.Dirent + + +When [`fs.readdir()`][] or [`fs.readdirSync()`][] is called with the +`withFileTypes` option set to `true`, the resulting array is filled with +`fs.Dirent` objects, rather than strings or `Buffers`. + +### dirent.isBlockDevice() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a block device. + +### dirent.isCharacterDevice() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a character device. + +### dirent.isDirectory() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a file system +directory. + +### dirent.isFIFO() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a first-in-first-out +(FIFO) pipe. + +### dirent.isFile() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a regular file. + +### dirent.isSocket() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a socket. + +### dirent.isSymbolicLink() + + +* Returns: {boolean} + +Returns `true` if the `fs.Dirent` object describes a symbolic link. + + +### dirent.name + + +* {string|Buffer} + +The file name that this `fs.Dirent` object refers to. The type of this +value is determined by the `options.encoding` passed to [`fs.readdir()`][] or +[`fs.readdirSync()`][]. + ## Class: fs.FSWatcher