Why are fs.dirent.isSymbolicLink() results diffenent to stats.isSymbolicLink() in windows Node.js?

Viewed 32

I have some files and dirs on windows. use ls in PowerShell it returns:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----l         2021/7/29     17:29                Saved Pictures
-a---l         2021/5/12     15:39         421888 LICEcap1.26.exe

Because of the l in Mode, they look like a symbolic link.

When I call isSymblickLink() of Dirent returned by fs.readdirSync(filename, {withFileTypes: true}), it also returns true

But, When I use fs.lstat(filename) and then stat.isSymblickLink(), it returns false

So why are fs.dirent.isSymbolicLink() results diffenent to fs.stats.isSymbolicLink()?

Is this normal or a bug of Windows?

0 Answers
Related