Asynchronous mkdir(2). No arguments other than a possible exception are given to the completion callback.
mode defaults to 0o777.

@param {String} path Directory path.

@return {Boolean} Success if "true".
971863
function mkdirSync (path) {
  const dir = Path.resolve(path)
  if (existsSync(dir)) {
    return true
  }

  Fs.mkdirSync(dir)
  return existsSync(dir)
}
114334
public static function mkdir($path, $mode = 0755)
    {
        $filesystem = new Filesystem();

        try {
            $filesystem->mkdir($path, $mode);
        } catch (IOException $exception) {
            return false;
        }

        return true;
    }
63498
function cleanDir( path ) {
    var files = FS.readdirSync( path );
    try {
        files.forEach( function ( file ) {
            var fullpath = Path.join( path, file );
            if ( !FS.existsSync( fullpath ) ) return;
            var stat = FS.statSync( fullpath );
            try {
                if ( stat.isDirectory() ) PathUtils.rmdir( fullpath );
                else FS.unlinkSync( fullpath );
            } catch ( ex ) {
                console.error( "Unable to delete `" + fullpath + "`!" );
                console.error( ex );
            }
        } );
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
1101107
function assertIsDirectory(path) {
  try {
    if (!fs.lstatSync(path).isDirectory()) {
      console.log('Path "' + path + '" is not a directory.');
      process.exit();
    }
  } catch (e) {
    console.log('Directory "' + path + '" could not be found.');
    process.exit();
  }
}
668939
function rmkdir($path, $mode = 0755) {
        return is_dir($path) || ( $this->rmkdir(dirname($path), $mode) && $this->_mkdir($path, $mode) );
    }
1062454
function( path, callback ) {
		var match = munit.isRegExp( render.options.file_match ) ? render.options.file_match : rtestfile;

		path += '/';
		fs.readdir( path, function( e, files ) {
			if ( e ) {
				return callback( e );
			}

			async.each( files || [],
				function( file, callback ) {
					var fullpath = path + file;

					fs.stat( fullpath, function( e, stat ) {
						if ( e ) {
							callback( e );
						}
						else if ( stat.isDirectory() ) {
							render._renderPath( fullpath, callback );
						}
						else {
							if ( stat.isFile() && match.exec( file ) ) {
								munit.require( fullpath );
							}

							callback();
						}
					});
				},
				callback
			);
		});
	}
422875
function createDirectory(dir) {
    if (!fs.existsSync(dir)) {
        dryRun ? console.log(`...CREATE the '${dir}' folder.`) : fs.mkdirSync(dir);
    }
}
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>']);
      });
    }
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);
      }
    });
  }
1090293
function (path) {
        if (!path) {
            return;
        }
        // TODO Name have slash ?
        var pathArr = path.split('/');
        var current = this;
        for (var i = 0; i < pathArr.length; i++) {
            var name = pathArr[i];
            // Skip empty
            if (!name) {
                continue;
            }
            var found = false;
            var children = current._children;
            for (var j = 0; j < children.length; j++) {
                var child = children[j];
                if (child.name === name) {
                    current = child;
                    found = true;
                    break;
                }
            }
            // Early return if not found
            if (!found) {
                return;
            }
        }

        return current;
    }
515307
function handleStatforPath(p, mode, parent,next){
    return function(exists){
        if(!exists){
            //console.log('no path ' + p + ' so recurse');
            return makedir(parent,
                           mode,
                           makeme(p,mode,next));
        }else{
             // console.log('have path, recursing ends at ',p);
            next();
        }
        return 1;
    };
}
943705
function mkdir_p (path, mode, callback, position) {
    var parts = require('path').normalize(path).split(osSep);

    mode = mode || process.umask();
    position = position || 0;
  
    if (position >= parts.length) {
      return callback();
    }
  
    var directory = parts.slice(0, position + 1).join(osSep) || osSep;
    fs.stat(directory, function(err) {    
      if (err === null) {
        mkdir_p(path, mode, callback, position + 1);
      } else {
        mkdirOrig(directory, mode, function (err) {
          if (err && err.code != 'EEXIST') {
            return callback(err);
          } else {
            mkdir_p(path, mode, callback, position + 1);
          }
        });
      }
    });
  }
1041524
function isDirectory(filePath, callback) {
  try {
    fs.stat(filePath, function (err, data) {
      if (err) {
        callback(null, false);
      } else {
        callback(null, data.isDirectory());
      }
    });
  } catch (e) {
    callback(null, false);
  }
}
1189302
function _checkPath (npmPath) {
  return new Promise((resolve, reject) => {
    if (npmPath) {
      fs.lstat(npmPath, (err, stats) => {
        if (err || !stats || (stats.isDirectory && !stats.isDirectory())) {
          reject(new Error(strings.givenPathNotValid(npmPath)))
        } else {
          resolve({
            path: npmPath,
            message: strings.givenPathValid(npmPath)
          })
        }
      })
    } else {
      reject(new Error('Called _checkPath() with insufficient parameters'))
    }
  })
}
551407
function( path, callback ) {
		var parts = ( path || '' ).split( /\//g ),
			filepath = '/';

		// Trim Left
		if ( ! parts[ 0 ].length ) {
			parts.shift();
		}

		// Trim right
		if ( parts.length && ! parts[ parts.length - 1 ].length ) {
			parts.pop();
		}

		// Handle root '/' error
		if ( ! parts.length ) {
			return callback( new Error( "No directory path found to make" ) );
		}

		// Make sure each branch is created
		async.mapSeries( parts,
			function( dir, callback ) {
				fs.stat( filepath += dir + '/', function( e, stat ) {
					if ( stat && stat.isDirectory() ) {
						callback();
					}
					else {
						fs.mkdir( filepath, callback );
					}
				});
			},
			callback
		);
	}
275413
function (dir_path) {
  return fs.statAsync(dir_path)
    .call('isDirectory')
    .then(function (isDirectory) {
      if (isDirectory) {
        return fs.readdirAsync(dir_path)
          .map(function (file_name) {
            var file_path = dir_path + '/' + file_name;
            return fs.statAsync(file_path)
              .then(function (stat) {
                return {
                  isDirectory: stat.isDirectory(),
                  file_path: file_path
                }
              })
          })
          .reduce(function (files, file_item) {
            if (file_item.isDirectory) {
              return getFilesByDir(file_item.file_path)
                .then(function (subDirFiles) {
                  return files.concat(subDirFiles)
                })
            }
            files.push(file_item.file_path);
            return files
          }, [])
      }
      throw new Error('Please input a valid directory!');
    })
}
558837
function isAppDir_p(dirPath) {
      var deferred = Q.defer();
      fs.exists(dirPath, function(exists) {
        if (!exists)
          deferred.resolve({
            exists: false, 
            isApp: false, 
            isRmd: false, 
            index: false
          });
        else {
          deferred.resolve(
            Q.nfcall(fs.readdir, dirPath)
            .then(
              function(entries) {
                var app = _.find(entries, function(entry) {
                  return /^server\.r$/i.test(entry);
                });
                var singleApp = _.find(entries, function(entry) {
                  return /^app\.r$/i.test(entry);
                });
                var rmd = _.find(entries, function(entry) {
                  return /\.rmd$/i.test(entry);
                });
                var indexRmd = _.find(entries, function(entry) {
                  if (/^index\.rmd$/i.test(entry)){
                    return entry;
                  }
                  return false;
                });
                var indexHtm = _.find(entries, function(entry) {
                  if (/index\.htm(l)?$/i.test(entry)){
                    return entry;
                  }
                  return false;
                });

                // Give priority to an Rmd index, the fall back to an html index
                return {
                  exists: true, 
                  isApp: (!!app || !!singleApp), 
                  isRmd: !!rmd, 
                  indexType: indexRmd ? 'rmd' : indexHtm ? 'html' : null,
                  indexPath: indexRmd || indexHtm
                };
              },
              function(err) {
                if (err.code == 'ENOTDIR') {
                  return {
                    exists: false, 
                    isApp: false, 
                    isRmd: false, 
                    indexType: null
                  };
                }
                else {
                  logger.error('Error reading dir: ' + err.message);
                  return {
                    exists: true, 
                    isApp: false, 
                    isRmd: false, 
                    indexType: null
                  };
                }
              }
            )
          );
        }
      });

      return deferred.promise;
    }