Skip to content

Commit 14d1b7a

Browse files
bengltargos
authored andcommitted
doc: add withFileTypes option to fsPromises.readdir
PR-URL: #22833 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 536c6ed commit 14d1b7a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/api/fs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4191,11 +4191,16 @@ a colon, Node.js will open a file system stream, as described by
41914191
### fsPromises.readdir(path[, options])
41924192
<!-- YAML
41934193
added: v10.0.0
4194+
changes:
4195+
- version: REPLACEME
4196+
pr-url: https://github.com/nodejs/node/pull/22020
4197+
description: New option `withFileTypes` was added.
41944198
-->
41954199

41964200
* `path` {string|Buffer|URL}
41974201
* `options` {string|Object}
41984202
* `encoding` {string} **Default:** `'utf8'`
4203+
* `withFileTypes` {boolean} **Default:** `false`
41994204
* Returns: {Promise}
42004205

42014206
Reads the contents of a directory then resolves the `Promise` with an array
@@ -4206,6 +4211,9 @@ object with an `encoding` property specifying the character encoding to use for
42064211
the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
42074212
will be passed as `Buffer` objects.
42084213

4214+
If `options.withFileTypes` is set to `true`, the resolved array will contain
4215+
[`fs.Dirent`][] objects.
4216+
42094217
### fsPromises.readFile(path[, options])
42104218
<!-- YAML
42114219
added: v10.0.0

0 commit comments

Comments
 (0)