Skip to content

Commit

Permalink
doc: remove superfluous await from fsPromises.readdir example
Browse files Browse the repository at this point in the history
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 36decec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 36decec

Please sign in to comment.