Smooth out differences between stat
and lstat
.
- Symbolic link stat returned by
lstat.isDirectory()
is alwaysfalse
. - To know if a link is a directory we should call
stat.isDirectory()
. stat.isSymbolicLink()
is always false.
npm i superstat
Create symlink to root directory:
ln -s / hello
const stat = await superstat('./hello');
stat.isDirectory()
// returns
true
stat.isSymbolicLink()
// returns
true
MIT