I can call
fs.readdirSync("C:\\", { withFileTypes: true })
and get array of fs.Dirent
, but they look like
> fs.readdirSync("C:\\", { withFileTypes: true })[32]
Dirent { name: 'Windows', [Symbol(type)]: 2 }
> fs.readdirSync("C:\\", { withFileTypes: true })[21]
Dirent { name: 'pagefile.sys', [Symbol(type)]: 1 }
> fs.readdirSync("C:\\", { withFileTypes: true })[10]
Dirent { name: 'Documents and Settings', [Symbol(type)]: 3 }
So there is a name and and type, but the type is hidden under Symbol(type) and I can't find any information how to get it from there.
Of course I can use a hack like
> x = fs.readdirSync("C:\\", { withFileTypes: true })[10]
Dirent { name: 'DoYourData iCloud Backup', [Symbol(type)]: 3 }
> x[Object.getOwnPropertySymbols(x)[0]]
3
But that seems strange.
If it's hidden for purpose, and there is nothing public except name, then I don't understand why do we have a special flag in option to get an object instead of simple string.