fileRead
The fileRead operation ingests the file located at the specified URI and returns a feed with one line of the target file's content per item.
Required Parameters
The input item for the fileRead operation must set the following parameter:
- file: a URI pointing to a file.
Optional Parameters
The input item for the fileRead operation can optionally set the following parameter:
- encoding: the encoding to use when reading the file. The allowed values are determined by the JVM/OS being used. Values for encodings that are generally supported by most operating systems and JVMs include UTF-8, ASCII, BASE64, Hex, windows-1522, and ISO-8859-2. The default is UTF-8.
Output Parameters
The output items returned by the fileRead operation have the following parameter:
- data: the data from the input file.
Example
In the following example, the path to the file "example.txt" is provided in the input item, the operation is executed, and, for each line in example.txt, the "currentlinevalue" variable is set to the value of the current line.
<api:set attr="input.file" value="C:/Users/Public/example.txt" /> <!-- Passing in the input item --> <api:call op="fileRead" in="input" out="result" > <api:set attr="fileOut.currentlinevalue" value="[result.data]" /> </api:call>