From de37ba34c5d6f3a2d18daf482f850be8fddb4621 Mon Sep 17 00:00:00 2001 From: Bryan English Date: Wed, 12 Sep 2018 21:32:29 -0700 Subject: 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(+) (limited to 'doc') diff --git a/doc/api/fs.md b/doc/api/fs.md index bade7dc750..8eb85bee5f 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4196,11 +4196,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 @@ -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])