heaptree-logo
Heaptree

Download

Download a file from a node to your local machine

Signature

def download(node_id: str, remote_path: str, local_path: str) -> DownloadResponse

Parameters

  • node_id (str) – target node
  • remote_path (str) – path of the file on the node
  • local_path (str) – local path where the file should be saved

Path Handling

All files that were placed using the upload function will be defaulted to the /home/ubuntu/Desktop/MY_FILES directory. If you specified a destination_path when using the upload function, it would have been adjusted to be prefixed by /home/ubuntu. For more details on this, visit the Path Handling section of upload guide.

Returns

DownloadResponse object with:

  • status (str) – operation status
  • remote_path (str) – path on the node that was downloaded from
  • local_path (str) – local path where file was saved

Example

result = client.download(
    node_id, 
    remote_path="/home/ubuntu/Desktop/MY_FILES/output.txt", 
    local_path="./output.txt"
)
print(f"File downloaded to: {result.local_path}")

Exceptions

  • MissingCredentialsException
  • FileToDownloadNotFoundException
  • InternalServerErrorException