We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1da4e4 commit 7e911d8Copy full SHA for 7e911d8
doc/api/fs.md
@@ -4972,6 +4972,18 @@ will be passed as `Buffer` objects.
4972
If `options.withFileTypes` is set to `true`, the resolved array will contain
4973
[`fs.Dirent`][] objects.
4974
4975
+```js
4976
+const fs = require('fs');
4977
+
4978
+async function print(path) {
4979
+ const files = await fs.promises.readdir(path);
4980
+ for (const file of files) {
4981
+ console.log(file);
4982
+ }
4983
+}
4984
+print('./').catch(console.error);
4985
+```
4986
4987
### `fsPromises.readFile(path[, options])`
4988
<!-- YAML
4989
added: v10.0.0
0 commit comments