All nodes/Integrations/Files

File Write

Write or replace lines in a file in the file store.

File Write▶
File storeOutcome
Error
File

Type in the graph: file_write

Exec

An error output can be enabled to handle failures on their own path.

Ports can be split into separate execution and data handles.

Try it

Minimal working scenario

Entry
File Write▶
Exit▶
  • Execute
  • Execute + Data
Press “Copy nodes”, open the editor and hit Ctrl+V on the canvas.

Runs as pasted

When to use it

The node saves text into a file, either whole or by replacing one range of lines. For tables use Write CSV or Write XLSX — they write a DataFrame in the right format. When the model creates files as the conversation goes, that is File Tool with fs_write ticked.

How it works

Where it writes is decided by Connection source. The default, “From the run context”, is the workspace’s own store: what you write shows up in the Files tab right away and counts against the files quota. In “External connection” mode the file_store port appears and the wired config node owns the root; the workspace quota does not apply to that write.

“Overwrite whole file” writes the field’s content over the entire file. “Replace a line range” reads the file, puts the replacement text in place of the lines from first to last (1-based, both ends inclusive) and writes the result back.

The output carries the path actually written and bytes_written. That is the size of the file after the write, not the length of what you substituted. The write ceiling is 4 MiB; above it the node fails with SIZE_LIMIT. There is deliberately no “success” flag in the output: a write that did not happen is a node failure, not a success carrying false.

Common mistakes

  • Replacing lines in a file that does not exist. replace_lines neither creates nor extends a file: the range has to exist in full, otherwise the node fails. Create the first version with an overwrite.
  • Expecting append. There is no append mode. To add a line to a log, read the file with File Read, join the text and write it back.
  • Empty content. A template that renders to nothing overwrites the file with nothing — that is a valid zero-byte write, not an error.
  • Folders on WebDAV. Missing parent folders are created in the workspace store but not on a WebDAV disk: create the folder there first, or the server refuses the write.
  • Two branches writing to one path. There are no locks; whichever finishes last wins. Keep parallel branches on separate files — for example by putting the session id in the path.

Inputs

PortWirePayloadNotes
File storefile_storeDatadata—

shown when connection_source ≠ "auto"

Outputs

PortWirePayloadNotes
OutcomeoutputExecute + Dataexecute_dataobject
Erroron_errorExecute + Dataexecute_data—

shown when expose_error_output = true

FilefileDatadatafile

Configuration

FieldTypeDefaultDescription
File pathpathstring""

Relative to the store root; parent folders are created as needed.

supports templates

Write modemodestringoverwrite

overwrite replaces the whole file; replace_lines patches one 1-based inclusive line range.

Options: overwrite — Overwrite whole file, replace_lines — Replace a line range

Contentcontentstring""

Full file content when mode is overwrite.

supports templates

shown when «Write mode» = Overwrite whole file

Start linestart_lineinteger1

First line of the replaced range (1-based, inclusive).

shown when «Write mode» = Replace a line range

End lineend_lineinteger1

Last line of the replaced range (1-based, inclusive).

shown when «Write mode» = Replace a line range

Replacement textreplacementstring""

Text written over the selected line range.

supports templates

shown when «Write mode» = Replace a line range

Connection sourceconnection_sourcestringauto

Where this node gets its connection. 'From the run context' uses what the platform already knows (the Telegram bot this workflow is deployed to / this workspace's own file store) and needs no wiring. 'External connection' shows the resource port so a config node can be wired into it.

Options: auto — From the run context, external — External connection (wire a config node)

Subfolderstore_subfolderstring""

Optional folder inside this workspace's store to treat as the root, e.g. `reports` or `sessions/{{ variables.session_id }}`. Blank = the store root.

supports templates

shown when «Connection source» = From the run context

Shared fields

Every node has these three — the platform adds them, not the node author.

  • expose_error_output — When enabled, show an execution output to connect nodes that run if this step fails.
  • split_ports_in — Show separate execution and data input handles instead of one combined port.
  • split_ports_out — Show separate execution and data output handles instead of one combined port.