Skip to content

Commit de37ba3

Browse files
bengltrivikr
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 70c2ebc commit de37ba3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/api/fs.md

+8
Original file line numberDiff line numberDiff line change
@@ -4196,11 +4196,16 @@ a colon, Node.js will open a file system stream, as described by
41964196
### fsPromises.readdir(path[, options])
41974197
<!-- YAML
41984198
added: v10.0.0
4199+
changes:
4200+
- version: REPLACEME
4201+
pr-url: https://github.com/nodejs/node/pull/22020
4202+
description: New option `withFileTypes` was added.
41994203
-->
42004204

42014205
* `path` {string|Buffer|URL}
42024206
* `options` {string|Object}
42034207
* `encoding` {string} **Default:** `'utf8'`
4208+
* `withFileTypes` {boolean} **Default:** `false`
42044209
* Returns: {Promise}
42054210

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

4219+
If `options.withFileTypes` is set to `true`, the resolved array will contain
4220+
[`fs.Dirent`][] objects.
4221+
42144222
### fsPromises.readFile(path[, options])
42154223
<!-- YAML
42164224
added: v10.0.0

0 commit comments

Comments
 (0)