Skip to content

Commit

Permalink
doc: add withFileTypes option to fsPromises.readdir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bengl authored and trivikr committed Sep 15, 2018
1 parent 70c2ebc commit de37ba3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4196,11 +4196,16 @@ a colon, Node.js will open a file system stream, as described by
### fsPromises.readdir(path[, options])
<!-- YAML
added: v10.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/22020
description: New option `withFileTypes` was added.
-->

* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* `withFileTypes` {boolean} **Default:** `false`
* Returns: {Promise}

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

If `options.withFileTypes` is set to `true`, the resolved array will contain
[`fs.Dirent`][] objects.

### fsPromises.readFile(path[, options])
<!-- YAML
added: v10.0.0
Expand Down

0 comments on commit de37ba3

Please sign in to comment.