Description
Reads the contents of a file from the sandbox filesystem. Supports both text and binary files with automatic encoding detection.Method Signature
Parameters
Absolute path to the file to read
Returns
Result of the read operation
Whether the file was read successfully
Path to the file that was read
Content of the file (UTF-8 for text files, base64 for binary files)
ISO 8601 timestamp of when the operation completed
Encoding used for the content
Whether the file is detected as binary
MIME type of the file (e.g., ‘image/png’, ‘text/plain’)
File size in bytes
Exit code from the underlying read command (0 = success)
Examples
Read a text file
Read a binary file
Read with custom encoding
Error Handling
The method throws an error if:- The file does not exist
- The file cannot be read due to permissions
- The path is invalid
See Also
- writeFile - Write content to a file
- streamFile - Stream file contents for large files
- collectFile - Read entire file from stream