node
node copied to clipboard
fs.readdir recursive: is `parentPath` supposed to be the same as `path`?
Affected URL(s)
No response
Description of the problem
I'm curious what the purpose of parentPath
is on Dirent objects when using fs.readdir
or fs.readdirSync
when both withFileTypes
and recursive
are set to true.
The reason for this issue is that I haven't found a situation where parentPath
differs from path
, it's always the same value. My hunch is that it's not supposed to be and there is probably a bug.
FWIW, I think it would be more useful to include the relative
path versus parentPath
, since parentPath
is just the path.dirname(path)
of each path, isn't it? If not, perhaps parentPath
isn't the best name? Maybe it should be base
or root
or something?