Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ed142e1

Browse filesBrowse files
bengltargos
authored andcommitted
doc: add withFileTypes option to fsPromises.readdir
PR-URL: #22833 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 8e8748c commit ed142e1
Copy full SHA for ed142e1

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.