Skip to content

write-file ​

Create, replace, or append a text file using authored content or a bound input.

When to use it ​

Use this node for reports and small generated artifacts. Review its path and replacement behavior before running it.

Example ​

rattish
Rattish: 1

Workflow:
  name: Write text

Node step:
  type: write-file
  path: reports/message.txt
  content: Hello from Raticode!
  overwrite: false
  finish: pass

The default creates missing parent directories and allows replacement. This example sets overwrite: false so an existing report is preserved. Enable append only when adding text to an existing artifact is intended.

Binding with.stdin replaces authored content for that activation. Non-append writes use an atomic replacement path and refuse a symlink destination. Output reports the actual action and byte/character counts.

Configuration ​

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

FieldTypeRequired / defaultMeaning
pathstringRequiredTarget filesystem path.
contentstring""Authored text to write.
encodingstring"utf-8"Text encoding.
create-dirsbooleantrueAllow creation of missing destination parents.
overwritebooleantrueAllow replacing an existing destination.
appendbooleanfalseAppend instead of replacing text.

Inputs and output ​

Bind these declared ports through with:

PortValue type
stdinstring

Successful output fields use these exact selector names:

FieldValue type
pathstring
actioncreated, replaced, appended
bytes_writteninteger (min 0)
characters_writteninteger (min 0)

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

Preflight and limits ​

The destination must satisfy the directory and overwrite policy, and the encoding must be supported. When the node has needs, a missing parent directory is allowed because an upstream step may create it. Validation never creates the report.

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.