I\'m trying to write a function that tells me is a certain path is a directory.
var fs = require(\'fs\');
console.log(\"+++++++++++++++++++++++++++++++++++++++\"
You are using the synchronous version, which doesn't use a callback. It simply returns the result instead. So either use the async form fs.stat(path, callback)
or use the sync form like this:
var fs = require('fs');
console.log("+++++++++++++++++++++++++++++++++++++++");
var stats = fs.statSync(pathname);
console.log(stats.isDirectory());
console.log("+++++++++++++++++++++++++++++++++++++++");