Node.js IsDirectory
Published on 12 August 2015 at 13:12 by
Here's a useful snippet for checking if a path is a directory in Node.js, this obviously requires('fs').
fs.lstatSync(path_string).isDirectory()
Also available to you:
fs.lstatSync(path_string).isFile()
fs.lstatSync(path_string).isDirectory()
fs.lstatSync(path_string).isBlockDevice()
fs.lstatSync(path_string).isCharacterDevice()
fs.lstatSync(path_string).isSymbolicLink()
fs.lstatSync(path_string).isFIFO()
fs.lstatSync(path_string).isSocket()