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 2cdd57a commit 06d5a9cCopy full SHA for 06d5a9c
doc/api/fs.md
@@ -4921,6 +4921,18 @@ will be passed as `Buffer` objects.
4921
If `options.withFileTypes` is set to `true`, the resolved array will contain
4922
[`fs.Dirent`][] objects.
4923
4924
+```js
4925
+const fs = require('fs');
4926
+
4927
+async function print(path) {
4928
+ const files = await fs.promises.readdir(path);
4929
+ for (const file of files) {
4930
+ console.log(file);
4931
+ }
4932
+}
4933
+print('./').catch(console.error);
4934
+```
4935
4936
### `fsPromises.readFile(path[, options])`
4937
<!-- YAML
4938
added: v10.0.0
0 commit comments