Actions15
Overview
The node provides comprehensive file and folder management capabilities on the local disk. It supports a variety of operations such as writing data to files, reading files, appending content, changing permissions, copying, moving, compressing, extracting archives, listing directory contents, checking existence, retrieving metadata, renaming, removing files/folders, and searching files by pattern.
For the Write operation specifically, the node writes provided string content to a specified target file path using a chosen encoding. This is useful for automating file creation or updates within workflows, such as generating configuration files, logs, or reports dynamically.
Practical examples:
- Writing JSON or text data to a log file after processing.
- Creating or overwriting a configuration file with updated parameters.
- Saving output from previous nodes into a file for archival or further use.
Properties
| Name | Meaning |
|---|---|
| Source Path | Path of the source file or folder (not used in Write operation but required generally). |
| Target Path | Path of the file to write data to. |
| Data | The string content that will be written to the target file. |
| Encoding | File encoding format to use when writing the data. Default is utf8. |
Output
The node outputs an array of items where each item contains a json object with the following fields relevant to the Write operation:
operation: The string"write"indicating the performed operation.success: Booleantrueif the write operation succeeded.targetPath: The path of the file that was written to.
No binary data output is produced by this operation.
Example output JSON snippet:
{
"operation": "write",
"success": true,
"targetPath": "/path/to/target/file.txt"
}
Dependencies
- Requires access to the local filesystem where n8n is running.
- No external API keys or services are needed.
- Node uses Node.js built-in
fsmodule for file operations. - Proper file system permissions must be granted to the user running n8n to write to the specified paths.
Troubleshooting
Common issues:
- Permission denied errors if the node process lacks write access to the target path.
- Invalid or non-existent target directory causing failure to write.
- Incorrect encoding specified may cause unexpected file content.
Error messages:
- Errors thrown by the underlying file system calls (e.g.,
EACCES,ENOENT) will be surfaced. - If the node encounters an unknown operation, it throws an error indicating the operation is unsupported.
- Errors thrown by the underlying file system calls (e.g.,
Resolutions:
- Ensure the target directory exists and is writable.
- Verify the encoding is supported (commonly
utf8). - Use absolute paths to avoid ambiguity.
- Check n8n's execution environment permissions.