X Tutup
The Wayback Machine - https://web.archive.org/web/20210814110033/https://github.com/nodejs/node/commit/36decec87f
Skip to content
Permalink
Browse files
doc: remove superfluous await from fsPromises.readdir example
The `await` operator in the example, iterating over the returned array
of filenames is not necessary, since the returned array is either
consisting of `string`s or of `fs.Dirent` objects, neither providing
an asyncIterator.

Refs: nodejs/help#3317

PR-URL: #38293
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
michaelrommel authored and Trott committed Apr 19, 2021
1 parent 13d0de5 commit 36decec87f7b942146d13cdca7c609dfdb9f847d
Showing with 1 addition and 1 deletion.
  1. +1 −1 doc/api/fs.md
@@ -932,7 +932,7 @@ import { readdir } from 'fs/promises';
try {
const files = await readdir(path);
for await (const file of files)
for (const file of files)
console.log(file);
} catch (err) {
console.error(err);

0 comments on commit 36decec

Please sign in to comment.
X Tutup