Skip to content

Commit 817bafb

Browse files
committed
doc: clarify Dirent parentPath
1 parent 2d6cbea commit 817bafb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

doc/api/fs.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7291,6 +7291,11 @@ changes:
72917291
* Type: {string}
72927292
72937293
The path to the parent directory of the file this {fs.Dirent} object refers to.
7294+
This value does not include `dirent.name`. For example, if
7295+
`fs.readdirSync('project', { withFileTypes: true, recursive: true })` returns
7296+
a {fs.Dirent} object for `project/src/index.js`, its `parentPath` is
7297+
`'project/src'` and its `name` is `'index.js'`. Use
7298+
`dirent.parentPath` and `dirent.name` together to build the full path.
72947299
72957300
### Class: `fs.FSWatcher`
72967301

0 commit comments

Comments
 (0)