AsyncClient

class hdfs_native.AsyncClient(url: str | None = None, config: Dict[str, str] | None = None)

Bases: object

Methods Summary

append(path)

Opens an existing file to append to at path

create(path[, write_options])

Creates a new file and opens it for writing at path

delete(path[, recursive])

Deletes a file or directory at path.

get_acl_status(path)

Get the ACL status for the file or directory at path.

get_content_summary(path)

Gets a content summary for path

get_file_info(path)

Gets the file status for the file at path

list_status(path[, recursive])

Gets the status of files rooted at path.

mkdirs(path[, permission, create_parent])

Creates a directory at path with unix permissions permission.

modify_acl_entries(path, entries)

Update ACL entries for file or directory at path.

read(path)

Opens a file for reading at path

remove_acl(path)

Remove all ACL entries for file or directory at path.

remove_acl_entries(path, entries)

Remove specific ACL entries for file or directory at path.

remove_default_acl(path)

Remove all default ACLs for file or directory at path.

rename(src, dst[, overwrite])

Moves a file or directory from src to dst.

set_acl(path, entries)

Override all ACL entries for file or directory at path.

set_owner(path[, owner, group])

Sets the owner and/or group for the file at path

set_permission(path, permission)

Sets the permissions for file at path to the octal value permission.

set_replication(path, replication)

Sets the replication for file at path to replication

set_times(path, mtime, atime)

Changes the modification time and access time of the file at path to mtime and atime, respectively.

Methods Documentation

async append(path: str) AsyncFileWriter

Opens an existing file to append to at path

async create(path: str, write_options: WriteOptions | None = None) AsyncFileWriter

Creates a new file and opens it for writing at path

async delete(path: str, recursive: bool = False) bool

Deletes a file or directory at path. If recursive is True and the target is a directory, this will delete all contents underneath the directory. If recursive is False and the target is a non-empty directory, this will fail.

async get_acl_status(path: str) AclStatus

Get the ACL status for the file or directory at path.

async get_content_summary(path: str) ContentSummary

Gets a content summary for path

async get_file_info(path: str) FileStatus

Gets the file status for the file at path

list_status(path: str, recursive: bool = False) AsyncIterator[FileStatus]

Gets the status of files rooted at path. If recursive is true, lists all files recursively.

async mkdirs(path: str, permission: int = 493, create_parent: bool = False) None

Creates a directory at path with unix permissions permission. If create_parent is true, any parent directories that don’t exist will also be created. Otherwise this will fail if all parent directories don’t already exist.

async modify_acl_entries(path: str, entries: List[AclEntry]) None

Update ACL entries for file or directory at path. Existing entries will remain.

async read(path: str) AsyncFileReader

Opens a file for reading at path

async remove_acl(path: str) None

Remove all ACL entries for file or directory at path.

async remove_acl_entries(path: str, entries: List[AclEntry]) None

Remove specific ACL entries for file or directory at path.

async remove_default_acl(path: str) None

Remove all default ACLs for file or directory at path.

async rename(src: str, dst: str, overwrite: bool = False) None

Moves a file or directory from src to dst. If overwrite is True, the destination will be overriden if it already exists, otherwise the operation will fail if the destination exists.

async set_acl(path: str, entries: List[AclEntry]) None

Override all ACL entries for file or directory at path. If only access ACLs are provided, default ACLs are maintained. Likewise if only default ACLs are provided, access ACLs are maintained.

async set_owner(path: str, owner: str | None = None, group: str | None = None) None

Sets the owner and/or group for the file at path

async set_permission(path: str, permission: int) None

Sets the permissions for file at path to the octal value permission. For example, to set “rw-r–r–” Unix style permissions, use permission=0o644.

async set_replication(path: str, replication: int) bool

Sets the replication for file at path to replication

async set_times(path: str, mtime: int, atime: int) None

Changes the modification time and access time of the file at path to mtime and atime, respectively.