From ed142e135553e5fdae64af1ede7311205613aacd Mon Sep 17 00:00:00 2001 From: Bryan English Date: Wed, 12 Sep 2018 21:32:29 -0700 Subject: [PATCH] doc: add withFileTypes option to fsPromises.readdir PR-URL: https://github.com/nodejs/node/pull/22833 Reviewed-By: Anatoli Papirovski Reviewed-By: Vse Mozhet Byt Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- doc/api/fs.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 11dfb04df9c443..20c6b761c4c824 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4170,11 +4170,16 @@ a colon, Node.js will open a file system stream, as described by ### fsPromises.readdir(path[, options]) * `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 @@ -4185,6 +4190,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])