heaptree-logo
Heaptree

Read Files

Read text content from a file on a node

Signature

def read_files(node_id: str, file_path: str) -> ReadFilesResponse

Parameters

  • node_id (str) – target node
  • file_path (str) – the path of the file on the target node

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

ReadFilesResponse object with:

  • status (str) – operation status
  • message (str) – response message
  • file_content (str) – content of the file
  • file_path (str) – path that was read from
  • node_id (str) – target node ID

Example

result = client.read_files(
    node_id, 
    file_path="/home/ubuntu/Desktop/MY_FILES/data.txt"
)
print(result.file_content)