code: function checkWorkingDir(workingDir, cb) {
    fs.stat(workingDir, function(err, stats) {
      var errMessage;
      if (err) {
        errMessage = "The directory " + workingDir + " does not exist.";
        logger.error(errMessage);
        return cb(errMessage);
      }
  
      //Checking that it is a directory
      if (!stats.isDirectory()) {
        errMessage = "Expected " + workingDir + " to be a directory";
        logger.error(errMessage);
        return cb(errMessage);
      }
  
      return cb();
    });
  }
docs: checkWorkingDir - Checking that the working directory exists and is a directory.
  
  @param  {string} workingDir Path to the working directory
  @param  {function} cb