FileUtils icon

FileUtils

File system operations utility

Write File

AI-generated

Overview

This node operation writes content to a specified file path on the file system. It supports writing text, binary data, or Base64-encoded strings to files. Users can choose to append content to existing files or overwrite them, and optionally create the directory if it does not exist. This operation is useful for automating file creation or updates, such as saving logs, exporting data, or storing processed information.

Use Case Examples

  1. Writing a text report to a log file with UTF-8 encoding.
  2. Saving an image file from binary data received from a previous node.
  3. Appending new data to an existing CSV file for incremental data collection.

Properties

Name Meaning
File Path The path to the file where content will be written.
Content The content to write into the file, either as text or Base64 string, depending on content type.
Content Type The type of content being written: text, binary property, or Base64 string.
Binary Property The name of the binary property containing the binary data to write (required if content type is binary).
Encoding The encoding format for the file when writing text content (e.g., UTF-8, ASCII, Base64, Binary).
Append Whether to append the content to the end of the file instead of overwriting it.
Create Directory Whether to automatically create the directory if it does not exist.

Output

JSON

  • json - Output JSON object containing the result of the write operation, such as success status or error information.

Troubleshooting

  • File path is required; ensure the 'File Path' property is set correctly.
  • If writing binary content, the specified binary property must exist in the input item.
  • Base64 content must be a valid Base64 string when content type is 'Base64 String'.
  • Permissions issues may prevent writing to the specified file path; verify file system permissions.
  • If 'Create Directory' is false and the directory does not exist, the operation will fail.

Discussion