Skip to main content Skip to footer

File Reader Documentation

Version: 1.0.0

Retrieved: 2025-10-09 15:15:51


File Reader

The module reads text or bytes from a file into a property and passes it to the next module(s).

This module is designed to be located in the middle of a flow.

Settings

Name Requirements Purpose Default
Static Filename String with length 0-64 Use this filename all the time  
Filename Property String with length 0-64 Dynamic filename set by the incoming message  
Target Property String with length 1-64 The property to write the file content into data
Output format   The output format the module should produce. If 'Detect' is selected, the module will try to detect the format Detect
Encoding   The character encoding of the text in the file (if file includes text) Detect

Output format

If Output format is set to Detect the module will try to find the format. If it detects that the file contains text the output format will be of type string. If it contains bytes the output format will be an array of bytes (byte[]).

File Text Encoding (if file contains text)

If Encoding is set to Detect, the module will do its best to try to discover which text encoding is used by the file to make sure all characters are read correctly. If it can't detect an encoding it will use UTF-8. It is also possible to force the module to read the file using a specific encoding using the Encoding setting. In e.g. ANSI encoding usually can't be detected by the module and must therefore be specified in the settings.

Input

Either Static Filename or Filename Property must be set. to be included. If Static Filename is set it will be used, otherwise Filename Property will be used.

Output

The same as input with the file content written into the Target Property

Example 1

Usage with static filename. We assume that the file test.txt contains the text Hello World

Settings

Static Filename = test.txt Target Property = data.fileContent Output format = Detect

Input

{
  example:{
    data:{
      temp:23.6,
      date:'2019-02-12'
    }
  }
}

Output

{
  example:{
    data:{
      temp:23.6,
      date:'2019-02-12',
      fileContent: 'Hello World'
    }
  }
}

Example 2

Usage with dynamic filename. We assume that the file sample.txt contains the text Hello World

Settings

Static Filename = `` Filename Property = filename Target Property = say.hello Output format = Detect

Input

{
  filename: 'sample.txt'
}

Output

{
  filename: 'sample.txt',
  say:{
    hello:'Hello World'
  }
}

Example 3

Usage with static filename reading a binary file. We assume that the file binary_file is a binary file.

Settings

Static Filename = binary_file Target Property = data.fileContent Output format = Detect

Input

{
  example:{
    data:{
      temp:23.6,
      date:'2019-02-12'
    }
  }
}

Output

{
  example:{
    data:{
      temp:23.6,
      date:'2019-02-12',
      fileContent: [123, 52, 123]
    }
  }
}