File IO

Watch a file for changes, read its content as JSON, CSV, or text, and rename, copy, delete, or write files on a trigger.

What it does

File IO watches a file on disk and pulls its content into the graph. Point Path at a text, JSON or CSV file and it re-reads whenever the file changes on disk. JSON content can be narrowed with a JSONPath expression; CSV content can be split on a chosen delimiter and treated with or without a header row. Numbers found in the content come out as both a single first value and a full array, alongside the raw text, the file's basename, and its last-modified time.

The same node also pushes changes back out: switch on a write Operation (Rename, Copy, Delete, or Write Text) and fire Trigger to run it.

When to use it

ParameterTypeDefaultWhat it does
pathString""Path to the file to watch
parse_modeString"auto"How to parse the file content. One of: auto, json, csv, text.
json_pathString""JSONPath expression for JSON files (e.g., $.data.value)
csv_headerBooleantrueFirst row of CSV is a header
csv_delimiterString"comma"Column delimiter: comma (,), semicolon (;), tab, or pipe (|). One of: comma, semicolon, tab, pipe.
enabledBooleantrueEnable or disable file watching
operationString"None"File operation to perform when triggered. One of: None, Rename, Copy, Delete, Write Text.
source_pathString""Source path for rename/copy, or path to delete
dest_pathString""Destination path for rename/copy
write_contentAny—Text content to write (Write Text mode)
triggerBooleanfalseRising edge triggers the write operation

Gotchas

Turning Enabled off stops the file being watched. Content and the other read outputs stop updating rather than clearing.

Worked example

  1. Add a File IO node and set Path to a JSON config file on disk.

  2. Set Parse Mode to JSON and give Json Path a value like $.data.value to pull out just the field you need.

  3. Wire Content or Number downstream, then edit and save the file outside DNA and watch the graph update on the next cook.

  4. To automate a file operation instead, set Operation to "Copy", fill in Source Path and Dest Path, and pulse Trigger from upstream logic.

See also

CSV Import · JSON Import · Export · Numbers, signals & audio