Skip to main content

Read File

Reads the text file content at specified path.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Path - The path of the file that will be read.

Output

  • Result - The content of the file that is read

Options

  • Base64 - Reads a binary file and outputs the result as base64 text formatted

How It Works

The Read File node retrieves file content through the following process:

  1. Validates that the path is not empty
  2. Reads the entire file content into memory using ioutil.ReadFile
  3. If Base64 option is enabled:
    • Encodes the binary data to base64 string format
  4. If Base64 option is disabled:
    • Converts the bytes directly to a UTF-8 string
  5. Sets the content in the output variable

Requirements

  • Valid path to an existing file
  • Read permissions on the file
  • Sufficient memory to load the entire file content
  • For text files, content should be in a readable encoding (UTF-8 recommended)

Error Handling

Error CodeDescription
Core.Filesystem.ReadFile.ErrOnCreateNode configuration parsing failed
Core.Filesystem.ReadFile.ErrOnMessageInput message parsing failed
Core.FileSystem.ReadFile.ErrPathPath is empty
Core.FileSystem.ReadFile.ErrReadFileCannot read file (file not found, permission denied, or I/O error)
Core.FileSystem.ReadFile.SetOutputFailed to set output variable

Usage Examples

Example 1: Read Text File

Read a configuration file to extract settings:

{
"path": "C:\\Config\\settings.txt"
}

Configuration:

  • Base64: false

Output:

{
"content": "server=localhost\nport=8080\n..."
}

Example 2: Read Binary File as Base64

Read an image file and convert to base64 for embedding:

{
"path": "D:\\Images\\logo.png"
}

Configuration:

  • Base64: true

Output:

{
"content": "iVBORw0KGgoAAAANSUhEUgAA..."
}

Example 3: Read Log File for Processing

Read a log file to extract specific information:

{
"path": "C:\\Logs\\application_{{ $date }}.log"
}

Use the content output with String operations to parse log entries.

Usage Notes

  • The entire file is loaded into memory - be cautious with very large files
  • For text files, Base64 should be false to get readable string content
  • For binary files (images, PDFs, executables), enable Base64 to preserve data integrity
  • File encoding is assumed to be UTF-8 when Base64 is false
  • The node does not support streaming - entire file is read at once
  • Empty files return an empty string
  • Binary data without Base64 encoding may result in corrupted text

Tips

  • Use Path Exists before Read File to verify the file exists
  • Enable Base64 for binary files (images, PDFs, executables) to avoid data corruption
  • For large files, consider alternative approaches like reading line by line
  • Combine with JSON Parse or XML Parse nodes to process structured file content
  • Use with Loop nodes to read multiple files from a directory listing
  • For CSV files, use the CSV package nodes instead for better parsing
  • Cache file content in variables if you need to reference it multiple times
  • Consider file size limits of your environment when reading large files