Overview
This node reads the content of a file from the local filesystem. It supports reading files as plain text, binary (base64 encoded), or JSON (parsed). The node is useful in workflows where you need to ingest file data for further processing, such as reading configuration files, importing data dumps, or handling file-based inputs.
Practical examples:
- Reading a CSV or TXT file as text to parse and process its contents.
- Loading an image or other binary file as base64 to send it over APIs.
- Importing JSON files and automatically parsing them into structured data for workflow use.
Properties
| Name | Meaning |
|---|---|
| File Path | The full path to the file to read on the local filesystem. |
| Read Mode | How to interpret the file content: - Text: read as string with specified encoding - Binary: read as base64 encoded binary data - JSON: read as UTF-8 text and parse as JSON object |
| Encoding | The character encoding used when reading the file as text. Options: UTF-8, ASCII, UTF-16 LE, Base64, Hex. Only applicable if Read Mode is "Text". |
| Additional Options | A collection of optional settings: - Include File Stats: whether to include file metadata like size and timestamps - Property Name: name of the output property to store the file content (default "content") - Include File Object: whether to include a detailed file object with metadata - File Object Property Name: name of the property to store the complete file object (default "fileObject") - Max File Size (MB): maximum allowed file size; 0 means no limit |
Output
The node outputs an array of items, each containing a json object with the following structure:
- A property (default
"content", configurable) holding the file content, which can be:- A string (text content),
- A base64 encoded string (binary content),
- A parsed JSON object (if read mode is JSON).
filePath: the resolved absolute path of the file.fileName: the base name of the file.fileExtension: the file extension including the dot.readMode: the mode used to read the file (text,binary, orjson).
If "Include File Stats" is enabled, an additional fileStats object is included with:
size: file size in bytes,sizeHuman: human-readable file size,created,modified,accessed: timestamps,isFile,isDirectory: booleans,mode,uid,gid: permission and ownership info.
If "Include File Object" is enabled, a detailed file object is added under the configured property name, containing metadata and content.
Dependencies
- Requires access to the local filesystem where n8n is running.
- No external API keys or services are needed.
- Uses Node.js built-in modules:
fs,path.
Troubleshooting
- File not found error: Occurs if the specified file path does not exist or is incorrect. Verify the path is correct and accessible by n8n.
- Path is not a file: Happens if the path points to a directory or non-file entity. Ensure the path points to a regular file.
- File size exceeds limit: If the file size is larger than the configured max size, the node throws an error. Increase the limit or reduce file size.
- Failed to parse JSON: When reading as JSON, invalid JSON content causes an error. Validate the JSON file format.
- Invalid read mode: If an unsupported read mode is selected, the node will error out. Use one of the supported modes: text, binary, or json.
Enabling "Continue On Fail" allows the node to output errors per item instead of stopping execution.