Skip to content

Commit ed142e1

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 8e8748c commit ed142e1

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
@@ -4170,11 +4170,16 @@ a colon, Node.js will open a file system stream, as described by
41704170
### fsPromises.readdir(path[, options])
41714171
<!-- YAML
41724172
added: v10.0.0
4173+
changes:
4174+
- version: REPLACEME
4175+
pr-url: https://github.com/nodejs/node/pull/22020
4176+
description: New option `withFileTypes` was added.
41734177
-->
41744178

41754179
* `path` {string|Buffer|URL}
41764180
* `options` {string|Object}
41774181
* `encoding` {string} **Default:** `'utf8'`
4182+
* `withFileTypes` {boolean} **Default:** `false`
41784183
* Returns: {Promise}
41794184

41804185
Reads the contents of a directory then resolves the `Promise` with an array
@@ -4185,6 +4190,9 @@ object with an `encoding` property specifying the character encoding to use for
41854190
the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
41864191
will be passed as `Buffer` objects.
41874192

4193+
If `options.withFileTypes` is set to `true`, the resolved array will contain
4194+
[`fs.Dirent`][] objects.
4195+
41884196
### fsPromises.readFile(path[, options])
41894197
<!-- YAML
41904198
added: v10.0.0

0 commit comments

Comments
 (0)