Unify Automations
Logo
Text Reader

Text Reader

Logo

3 mins READ

The Text Reader Node reads a text file line by line, yielding each line to the steps inside the iterator block without loading the entire file into memory at once.

Overview

The Text Reader Node is an iterator node that walks a text file one line at a time, delivering each line to the loop body as it goes. Use it to process log files, delimited text, or any line-oriented content where you want to handle one line at a time rather than pulling the whole file into a variable. Because it iterates rather than reads-all, it stays efficient even on large files — memory use stays flat regardless of how many lines the file contains.

Screenshot 2026-08-31 at 13.45.27 1.png
Screenshot 2026-08-31 at 13.45.27 1.png

Pair the Text Reader with the loop body to apply transforms, filters, or writes to each line as it arrives. Use the Is First and Is Last flags exposed by the loop to run setup or teardown logic — opening a target file, flushing a buffer — without adding conditional branches to every pass.

Reading Text Files

The node's action, Consume data from text file, iterates a text file from its first line, exposing one line at a time to the steps inside the loop body. Each pass delivers the current line of text together with metadata about its position in the iteration. Turn on Batch to work on a batch of lines in each pass instead of a single line.

Inputs

Field

Description

File

The text file to iterate.

Batch

Turn on to work on a batch of lines in each pass instead of one line. Off by default.

Batch size

The number of lines in each batch. Shown when Batch is on. Default: 100.

Encoding

The encoding used in the text file. Default: UTF-8.

Loop Outputs

The following values are available inside the loop body on each pass:

Output

Description

Item

The current line of text from the file, or the current batch of lines when Batch is on.

Index

The zero-based position of the current pass within the iteration. The first pass has index 0.

Is First

True on the first iteration pass. Use this to run setup logic once — for example, opening a target file or initialising a counter.

Is Last

True on the final iteration pass. Use this to flush a buffer or finalise output after the last line has been processed.

Notes

Keep the following in mind when using the Text Reader Node.

  • Files are read as UTF-8 by default. Change Encoding if your file uses a different encoding.

  • The node always starts at the first line of the file. To skip header rows, add a condition inside the loop on Is First or Index.

  • Index is zero-based and counts passes, starting at 0 for the first pass.

  • Use the Is First and Is Last flags to run setup or teardown logic exactly once without conditional branches on every loop pass.

  • The node iterates rather than reads-all — memory use stays flat regardless of file size. Prefer this node over reading an entire file into a variable for any file large enough to matter.

  • For structured line-delimited data (one JSON object per line), consider the JSON Node instead — it parses each line as a record and exposes typed fields rather than raw text.

FAQs

What does Index represent and how is it counted?

Index is a zero-based counter that tracks the node's position within the current iteration. The first pass has index 0. Use Index when you need to count how many lines (or batches, when Batch is on) you have processed so far in this run.

How do I skip a header row?

The node always starts at the first line, so skip the header inside the loop. With Batch off, add a condition that skips the pass when Is First is true. If the file has several header rows, skip passes whose Index is lower than the number of header rows — for example, Index less than 3 to skip the first three rows.

Does the Text Reader load the whole file into memory?

No. The node walks one line at a time, so memory use stays flat regardless of how many lines the file contains. It is safe to use on large files — logs with millions of entries, large exports — without worrying about memory exhaustion.

Should I use the Text Reader or the JSON Node for JSONL files?

Use the JSON Node for JSONL. It parses each line as a structured record and exposes the object's fields directly, which makes downstream steps much simpler. The Text Reader yields raw text strings — appropriate for unstructured or custom-delimited content where you want full control over parsing.