S3FileSystem#
- class S3FileSystem[source]#
Bases:
FileSystemA FileSystem for interacting with files stored on AWS S3.
Uses Everett configuration of form:
` [AWS_S3] requester_pays=True `- __init__()#
Methods
__init__()copy_from(src_uri, dst_path)Copy a source file to a local destination.
copy_to(src_path, dst_uri)Copy a local source file to a destination.
file_exists(uri[, include_dir])Check if a file exists.
get_file_system(uri[, mode])Return FileSystem that should be used for the given URI/mode pair.
last_modified(uri)Get the last modified date of a file.
list_paths(uri[, ext, delimiter])List paths rooted at URI.
local_path(uri, download_dir)Return the path where a local copy should be stored.
matches_uri(uri, mode)Returns True if this FS can be used for the given URI/mode pair.
parse_uri(uri)Parse bucket name and key from an S3 URI.
read_bytes(uri)Read contents of URI to bytes.
read_str(uri)Read contents of URI to a string.
sync_from_dir(src_dir_uri, dst_dir[, delete])Syncs a source directory to a local destination directory.
sync_to_dir(src_dir, dst_dir_uri[, delete])Syncs a local source directory to a destination directory.
write_bytes(uri, data)Write bytes in data to URI.
write_str(uri, data)Write string in data to URI.
- static copy_from(src_uri: str, dst_path: str) None[source]#
Copy a source file to a local destination.
If the FileSystem is remote, this involves downloading.
- static copy_to(src_path: str, dst_uri: str) None[source]#
Copy a local source file to a destination.
If the FileSystem is remote, this involves uploading.
- static get_file_system(uri: str, mode: str = 'r') FileSystem#
Return FileSystem that should be used for the given URI/mode pair.
- Parameters:
- Return type:
- static list_paths(uri: str, ext: str = '', delimiter: str = '/') list[str][source]#
List paths rooted at URI.
Optionally only includes paths with a certain file extension.
- static local_path(uri: str, download_dir: str) None[source]#
Return the path where a local copy should be stored.
- static matches_uri(uri: str, mode: str) bool[source]#
Returns True if this FS can be used for the given URI/mode pair.
- static sync_from_dir(src_dir_uri: str, dst_dir: str, delete: bool = False) None[source]#
Syncs a source directory to a local destination directory.
If the FileSystem is remote, this involves downloading.
- static sync_to_dir(src_dir: str, dst_dir_uri: str, delete: bool = False) None[source]#
Syncs a local source directory to a destination directory.
If the FileSystem is remote, this involves uploading.