methods 
Async isDirectory
@param {string} directory : directory to check
@param {function|null} callback : operation's result
@returns {void}
327707
function _isDirectory (directory, callback) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" === typeof callback) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				lstat(directory, (err, stats) => {
					return callback(null, Boolean(!err && stats.isDirectory()));
				});

			}

		}
619546
function walkTree(directory, callback) {
    callback(directory);
    directory.directories.forEach(childDirectory => walkTree(childDirectory, callback));
}
865962
function isDirectory(filePath) {
	var isDir = false;
	try {
		var absolutePath = path.resolve(filePath);
		isDir = fs.lstatSync(absolutePath).isDirectory();
	} catch (e) {
		isDir = e.code === 'ENOENT';
	}
	return isDir;
}
997946
function findSync(dir, callback) {
	var rootStat = fs.statSync(dir);
	if (!rootStat.isDirectory()) {
		if (callback) callback(dir, rootStat);
		return [dir];
	}

	return fs.readdirSync(dir).reduce(function(files, file) {
		var p = path.join(dir, file),
			stat = fs.statSync(p);
		if (callback) callback(p, stat);
		files.push(p);

		if (stat.isDirectory()) {
			files.push.apply(files, findSync(p, callback));
		}

		return files;
	}, []);
}
113919
function (src, dst, callback) {

    if (fs.existsSync(dst)) {
        callback(src, dst);
    }
    else {
        fs.mkdirSync(dst);
        callback(src, dst);
    }
}
1226015
function findDirRec(dir, callback) {
      var result = path.resolve(dir, dirmod);
      fs.stat(result, function stat(err, stat) {
        if (err || !stat.isDirectory()) {
          if (lastResult == result) {
            callback(new Error('No configuration directory found.'));
            return;
          }
          lastResult = result;
          findDirRec(path.resolve(dir, '..'), callback);
        } else {
          callback(null, result);
        }
      });
    }
943495
async function exists(dir) {
  try {
    debug(`checking if ${dir} exists`);
    const s = await stat(dir);

    debug(`${dir} exists`);

    return s.isDirectory();
  }
  catch (err) {
    debug(`${dir} does not exist`);

    return false;
  }
}
904167
function ensureDir(dir) {
        try {
            if (!fs_1.existsSync(dir))
                fs_1.mkdirSync(dir);
            return true;
        }
        catch (ex) {
            return false;
        }
    }
1254020
function readDirectoryFiles(directory) {
  return new Promise((resolve, reject) => {
    fs.readdir(directory, (err, files) => {
      if (err) {
        reject(err);
        return;
      }

      const isFile = fileName => readFileStats(path.join(directory, fileName))
        .then((fstat) => {
          if (fstat.isFile()) {
            return fileName;
          }
          return null;
        });

      Promise.all(files.map(isFile))
        .then(fileList => resolve(fileList.filter(f => f !== null)))
        .catch(reject);
    });
  });
}
130360
function mkdirSync(dirPath) {
    // Get relative path to output
    const relativePath = dirPath.replace(`${CWD}${pathSep}`, '');
  	const dirs = relativePath.split(pathSep);
  	let currentDir = CWD;

    // Check if each dir exists, and if not, create it
    dirs.forEach(dir => {
      currentDir = path.resolve(currentDir, dir);
      if(!fs.existsSync(currentDir)) {
        fs.mkdirSync(currentDir);
      }
    });
  }
778625
function dirExists(dir, cb) {
  var fsExists = fs.exists || path.exists;
  fsExists(dir, function (exists) {
    if (!exists) {
      return cb(false);
    }
    fs.stat(dir, function (err, stat) {
      if (err) {
        return cb(false);
      }
      return cb(stat.isDirectory());
    });
  });
}
530762
function mkdirpSync(folder) {
  if (!fs.existsSync(path.dirname(folder))) {
    mkdirpSync(path.dirname(folder));
  }

  if (!fs.existsSync(folder)) {
    fs.mkdirSync(folder, '0755');
  }
}
216436
function listFiles(directory) {
    return fs.lstatAsync(directory)
        .then(lstat => lstat.isDirectory() ? fs.readdirAsync(directory) : [])
        .catchReturn([]);
}
422875
function createDirectory(dir) {
    if (!fs.existsSync(dir)) {
        dryRun ? console.log(`...CREATE the '${dir}' folder.`) : fs.mkdirSync(dir);
    }
}
59337
function dirMaker(target) {
    // check if parent directory exists
    var parentDir = path_1.dirname(target);
    if (!fs_1.existsSync(parentDir)) {
        dirMaker(parentDir);
    }
    // check if directory exists
    if (!fs_1.existsSync(target)) {
        fs_1.mkdirSync(target);
    }
}
26152
function checkCompile (dir) {
  return function  (mode, callback) {
    var exercise = this

    if (!exercise.passed)
      return callback(null, true) // shortcut if we've already had a failure

    gyp.rebuild(dir, function (err) {
      if (err) {
        exercise.emit('fail', err.message)
        return callback(null, false)
      }

      callback(null, true)
    })
  }
}
765223
function(callback) {
      fs.readdir(args['<directory>'], function(err, files) {
        // error here means it does not exist, which is good.
        if (err || args['--force']) {
          return callback(null, args['<directory>']);
        }
        if (files.length > 0) {
          return callback(new Error(format('destination '
            + 'directory %s is not empty.', path.resolve(args['<directory>']))));
        }
        return callback(null, args['<directory>']);
      });
    }