FileUtils icon

FileUtils

File system operations utility

Overview

This node provides a set of file system utility operations, including reading from and writing to files, listing directories, finding files, and searching content within files. The Write File operation specifically allows users to write data into a file on the filesystem with options for content type, encoding, appending, and directory creation.

Typical use cases include:

  • Saving dynamically generated text or binary data to a file.
  • Appending logs or results to existing files.
  • Creating files in new directories automatically if they do not exist.
  • Writing base64 encoded content or binary data from previous workflow steps.

For example, you might use this node to save an API response as a JSON file, append new entries to a log file, or store an image received as binary data.

Properties

Name Meaning
File Path Path to the target file where content will be written.
Content The actual content to write into the file. Can be plain text or a Base64 string depending on Content Type.
Content Type Specifies the format of the content to write. Options: Text, Binary Property, Base64 String.
Binary Property (If Content Type is Binary) The name of the binary property in the input item containing the data to write.
Encoding (If Content Type is Text) The encoding format for the file content. Options: UTF-8, ASCII, Base64, Binary.
Append Whether to append the content to the end of the file instead of overwriting it.
Create Directory If enabled, automatically creates the directory path if it does not exist before writing the file.

Output

The output contains JSON data representing the result of the write operation. Typically, this includes metadata about the written file such as its path and status. If the operation fails, error information is returned in the JSON output.

The node does not output binary data directly for the write operation; it only processes input binary data when writing.

Dependencies

  • Requires access to the local filesystem where n8n is running.
  • No external APIs or services are needed.
  • Permissions must allow the node process to write to the specified file paths.
  • No special environment variables are required beyond standard n8n setup.

Troubleshooting

  • File path is required: Ensure the "File Path" property is provided; otherwise, the node throws an error.
  • Content missing for Base64 string: When using Base64 string content type, the "Content" field must not be empty.
  • Binary property not found: If using binary content type, verify that the specified binary property exists in the input item.
  • Permission errors: Writing may fail due to insufficient permissions or non-existent directories (unless "Create Directory" is enabled).
  • Invalid encoding: Use supported encodings (UTF-8, ASCII, Base64, Binary) to avoid write errors.
  • Appending issues: If appending is enabled but the file does not exist, behavior depends on the underlying filesystem; enabling "Create Directory" can help ensure the path exists.

Links and References

Discussion