src/Helpers/FileHelperAsc.php
public static function createDir($dirPath, $mode = null, $recursive = true)
    {
        $dir = static::ensureDirObject($dirPath);
        $file = static::ensureFileObject($dirPath);
        if ($mode === null) {
            $mode = static::$fileCreateMode;
        }
        return $file->exists()
            ->then(null, function() use ($dir, $mode, $recursive) {
                $createMode = FileHelper::permissionsAsString($mode);
                return $recursive ? $dir->createRecursive($createMode) : $dir->create($mode);
            })->then(function() use ($dir, $mode) {
                return $dir->chmod($mode);
            });
    }
public static function createDir($dirPath, $mode = null, $recursive = true)
    {
        $dir = static::ensureDirObject($dirPath);
        $file = static::ensureFileObject($dirPath);
        if ($mode === null) {
            $mode = static::$fileCreateMode;
        }
        return $file->exists()
            ->then(null, function() use ($dir, $mode, $recursive) {
                $createMode = FileHelper::permissionsAsString($mode);
                return $recursive ? $dir->createRecursive($createMode) : $dir->create($mode);
            })->then(function() use ($dir, $mode) {
                return $dir->chmod($mode);
            });
    }
Create directory
@param string $dirPath
@param int    $mode
@param bool   $recursive
@return \React\Promise\PromiseInterface