Skip to content

read-file ​

Read a text file and pass its content and path metadata to downstream nodes.

When to use it ​

Use this node when another step needs actual text. The file node returns metadata only and is not a substitute for reading contents.

Example ​

rattish
Rattish: 1

Workflow:
  name: Read text

Node step:
  type: read-file
  path: notes/input.txt
  encoding: utf-8
  errors: strict
  finish: pass

Create notes/input.txt before preflight, or give the node needs on the step that creates it. UTF-8 with strict decoding is the default. Select the encoding that matches the file; suppressing decoding failures can conceal damaged input. File reads are bounded by the runtime resource limits.

Bind node.step.output.content downstream to consume the text. Output selectors preserve underscore field names such as file_name.

Configuration ​

Configuration fields use hyphens. These are the node-specific fields; shared execution fields apply separately.

FieldTypeRequired / defaultMeaning
pathstringRequiredTarget filesystem path.
encodingstring"utf-8"Text encoding.
errorsstring"strict"Text decoding error policy.

Inputs and output ​

This node has no declared input ports. Configure its authored fields directly.

Successful output fields use these exact selector names:

FieldValue type
contentstring
pathstring
file_namestring
file_stemstring
file_extensionstring
directorystring

For example, refer to node.step.output.content from a compatible downstream binding.

Preflight and limits ​

The path must exist and be readable, and the encoding/error policy must be supported. When the node has needs, preflight skips the existence check because an upstream step may create the file earlier in the run; the node then reports a missing file when it runs.

Use Raticode rattish check and Raticode rattish preflight before choosing to run the example. The installed contract is available through Raticode rattish docs --format json.

Continue with Node reference, Routes and joins, or Runs and approvals.