docs: format fs.readdir documentation section

This commit is contained in:
bcheidemann 2021-06-05 18:06:35 +01:00 committed by David Humphrey
parent 49ace4b2fb
commit 77abca991a
1 changed files with 5 additions and 1 deletions

View File

@ -870,7 +870,11 @@ fs.readdir('/docs', function(err, files) {
});
```
Optionally accepts an options parameter, which can be either an encoding (e.g. "utf8") or an object with optional properties `encoding` and `withFileTypes`. The `encoding` property is a `string` which will determine the character encoding to use for the names of each directory entry. The `withFileTypes` property is a `boolean` which defaults to `false`. If `true`, this method will return an array of [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) objects. The `name` property on the [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) object will be encoded using the specified character encoding.
Optionally accepts an options parameter, which can be either an encoding (e.g. "utf8") or an object with optional properties `encoding` and `withFileTypes`.
The `encoding` property is a `string` which will determine the character encoding to use for the names of each directory entry. The `withFileTypes` property is a `boolean` which defaults to `false`. If `true`, this method will return an array of [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) objects.
The `name` property on the [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) objects will be encoded using the specified character encoding.
#### fs.close(fd, callback)<a name="close"></a>