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

ParameterTypeDefault
pathString""
parse_modeString"auto"
json_pathString""
csv_headerBooleantrue
csv_delimiterString"comma"
enabledBooleantrue
operationString"None"
source_pathString""
dest_pathString""
write_contentAny
triggerBooleanfalse

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