Reference · Tools

Read/Write Files from Disk

Read files from or write files to the local filesystem on the server running the workflow engine.

Action (binary) Core Nodes v1 Binary data

Read/Write Files from Disk moves data between the filesystem and the workflow: reading files into binary data or writing binary data out to disk, all sandboxed to the execution's own files directory. A typical build is writing an intermediate file for a command-line tool to process, then reading the result back.

Node type
Action (binary)
Parameters
7
Outputs
Output, Error
Credentials
None required

Read/Write Files from Disk

Read or write files on the local filesystem

Overview

The Read/Write File tool provides two operations: (1) read — reads one or more files from the execution files directory using a path or glob pattern, producing one output item per matched file with binary data and metadata; (2) write — writes binary data from a workflow item to a specified file path within the execution files directory, with optional append mode. All filesystem operations are sandboxed to the execution-scoped directory to prevent directory traversal attacks.

Category: Core Nodes
Tool Name: read_write_file
Version: 1

Appearance: Icon: lucide-File | Color: #6b7280

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool does not require any credentials.

Operations

OperationValueDescription
Read File(s) From DiskreadRead one or more files from the local filesystem
Write File to DiskwriteWrite binary data to a file on the local filesystem

Parameters

Read File(s) From Disk (read)

ParameterTypeRequiredDefaultDescription
File(s) SelectorstringYesSpecify a file path or glob pattern to read one or more files. Use forward slashes even on Windows. Paths are relative to the execution files directory. Supports expressions like {{ $json.path }}.
Options (options)collectionNo{}Overrides applied to the metadata of every file this node reads.
— File ExtensionstringNoOverride the file extension in the output binary metadata.
— File NamestringNoOverride the file name in the output binary metadata.
— Mime TypestringNoOverride the MIME type in the output binary metadata.
— Put Output File in FieldstringNodataName of the binary property to store the file in. Default is ‘data’.

Write File to Disk (write)

ParameterTypeRequiredDefaultDescription
File Path and NamestringYesPath and name of the file to write, relative to the execution files directory. Include the file extension. Supports expressions like {{ $json.fileName }}.
Input Binary FieldstringYesdataThe name of the input binary field containing the file to be written. Names are case-sensitive.
Options (writeOptions)collectionNo{}Extra write settings.
— AppendbooleanNofalseWhether to append to an existing file instead of overwriting it. Commonly used with text files.

All Operations

ParameterTypeRequiredDefaultDescription
Max ConcurrencynumberNo10Maximum number of items to process concurrently.

Output Data

Read changes item cardinality: each input item produces one output item per matched file, so one item and a pattern matching eight files gives eight output items. Matching nothing is an error, not an empty result — the message names the selector you used.

Each output item’s JSON is the file’s metadata; the input item’s own JSON is not carried over.

{
  "mimeType": "text/csv",
  "fileType": "text",
  "fileName": "orders.csv",
  "fileExtension": "csv",
  "fileSize": "42.10 kB"
}
  • mimeType, fileName and fileExtension are detected from the file, unless the matching override in Options replaces them. The File Name and Mime Type overrides also apply to the attached binary data; the File Extension override changes this JSON field only.
  • fileType is the broad category from the MIME type (image, audio, video, text or application), or unknown.
  • fileSize is a human-readable string such as 938 B, 42.10 kB or 2.31 MB, not a number.

The file contents are attached as binary data under the name given by Put Output File in Field (data by default), merged with any binary the input item carried.

Write is one output item per input item. The input item JSON passes through with one field added:

  • fileName — the path you asked to write, exactly as supplied.

The written file is attached back to the item as binary data under the same name as Input Binary Field, carrying its fileName, mimeType and fileSize in bytes, merged with the item’s existing binary.

Reference the result downstream by expression, e.g. {{ $json.fileName }}.

Usage Examples

  • Read all CSV files from a directory
  • Write a generated PDF to disk
  • Read a single image file into binary data
  • Save an email attachment to the filesystem
  • Read files matching a glob pattern like *.xlsx

Example Configuration

Read a single file:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "read",
    "fileSelector": "documents/report.txt",
    "maxConcurrency": 5
  }
}

Read every log file, overriding the MIME type and the binary field name:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "read",
    "fileSelector": "logs/*.log",
    "options": {
      "mimeType": "text/plain",
      "dataPropertyName": "logContent"
    },
    "maxConcurrency": 10
  }
}

Read files with more than one extension:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "read",
    "fileSelector": "data/*.{json,csv}"
  }
}

Write a new file:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "write",
    "fileName": "output/result.json",
    "dataPropertyName": "jsonData",
    "maxConcurrency": 1
  }
}

Append to an existing file:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "write",
    "fileName": "logs/application.log",
    "dataPropertyName": "logEntry",
    "writeOptions": {
      "append": true
    },
    "maxConcurrency": 1
  }
}

Write a report per item, using an expression in the path:

{
  "type": "read_write_file",
  "parameters": {
    "operation": "write",
    "fileName": "reports/{{ $json.date }}.html",
    "dataPropertyName": "htmlContent",
    "writeOptions": {
      "append": false
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Read files from disk into binary data or write binary data to disk files, sandboxed to the execution files directory.

Behavior notes

  • Paths are relative and sandboxed. Everything is resolved inside this execution’s own files directory. Absolute paths and .. segments are rejected, and a file matched outside the directory is skipped. You can only read what a node in the same run has written.
  • Always use forward slashes in File(s) Selector and File Path and Name, on every platform.
  • Reading nothing is an error. Unlike a glob that quietly returns an empty list, this node fails the item when the selector matches no files, so a wrong path surfaces immediately.
  • Parent directories are created on write. exports/2026/data.csv works without a separate step.
  • Give each item its own path when writing in parallel. A fixed File Path and Name with several items means each write overwrites the last. Use an expression in the path, or set Append with Max Concurrency 1 when you deliberately want one accumulating file.
  • The Options overrides only relabel the file. File Name, File Extension and Mime Type change the metadata reported for the file; they do not convert its contents.

Frequently asked questions

Can it access any file on the server?

No. Everything is resolved inside this execution's files directory — absolute paths and `..` segments are rejected, and a file matched outside the directory is skipped. You can only read what a node in the same run has written.

What path separator should I use?

Always forward slashes in the file selection, regardless of the host operating system.

Why prefer this over the older read-binary nodes?

It covers the same jobs, reads several files at once with a glob, and writes as well as reads — the deprecated nodes exist only for workflows that already use them.

Does it need credentials?

No.

Build with the Read/Write Files from Disk node

Drop it into a workflow, wire it to an agent, or call it on a schedule.

Open BusyBot

Last updated . Spotted something wrong? Tell us.