code: function checkForChangedFolders(dir) {
      var fileList = fs.readdirSync(dir);
      for (var i = 0; i < fileList.length; i++) {
          if (!fs.existsSync(dir+fileList[i])) { continue; }
          var dirStat;
          try {
              dirStat = fs.statSync(dir + fileList[i]);
          } catch (e) {
              // This means the file disappeared between the exists and us stating the file.
              continue;
          }
          if (dirStat.isDirectory()) {
              if (!watchingFolders[dir + fileList[i]]) {
                  console.log("Adding new directory to watch: ", dir + fileList[i]);
                  setupWatchers(dir + fileList[i]);
              }
          }
      }
  }
docs: check for any changed folders on platforms (Mac's) that don't pass a filename in the callback
  @param dir
  @returns {*}