Skip to main content

put

Uploads a file or directory from a local path to a specified or automatically generated remote destination path using the underlying filesystem. Performs I/O operations asynchronously or synchronously depending on the underlying filesystem implementation.

async def put(
from_path: str,
to_path: Optional[str] = None,
recursive: bool = False,
batch_size: Optional[int] = None,
**kwargs,
) -> str: ...

Uploads a local file or directory to a specified or auto-generated remote storage path using the appropriate underlying filesystem. Handles both asynchronous and synchronous filesystems to perform the transfer.

Parameters​

NameTypeDescription
from_pathstrThe local source file or directory path to be uploaded.
to_pathOptional[str] = NoneThe destination path in remote storage. If omitted or None, a random remote path is generated based on the source filename.
recursivebool = FalseWhether to recursively upload contents if the source path is a directory.
batch_sizeOptional[int] = NoneThe number of concurrent operations or batch size to use during the upload when supported by the filesystem. Falls back to a default batch size if not specified.
**kwargsAnyAdditional keyword arguments passed directly to the underlying filesystem's put operation.

Returns​

TypeDescription
strThe destination file or directory path where the content was uploaded.