nodes / builtin / ai / loaders
File Document Loader
Load a file (PDF, HTML, text) as text to feed into the Indexer
Turn a PDF, HTML or text file into plain text, ready to index into a knowledge base.
What it does
Section titled “What it does”File Document Loader takes a file carried by the incoming item and puts its text in one output field, named by Output field name (text by default). It works out the file type from its MIME type, or else from the file name’s extension:
- PDF: the text of all pages, joined into one string. Uses the same extraction as PDF Parser.
- HTML: converted to clean plain text.
- Text formats: CSV, JSON, XML, Markdown and TXT (and any
text/type) are read as they are.
It first looks for a file attachment under Binary key / field. If there is none, it reads a field of that name holding a base64 string or a data URL (data:application/pdf;base64,...).
When to use it
Section titled “When to use it”- Index a PDF report, a Markdown doc or an exported CSV into a knowledge base.
- Handle a mix of PDF, HTML and text files with one node.
- When you only need the text of a PDF and won’t index it, PDF Parser gives more control.
Inputs and settings
Section titled “Inputs and settings”| Setting | Type | What it does |
|---|---|---|
| Binary key / field | Text | The binary attachment key on the input item (its $binary map), or a field holding a base64 / data-URL string. Default: data |
| Output field name | Text | The name of the output field that will hold the loaded text. Default: text |
| Options | Group | The options for the node. |
| Options › MIME type | Text | Override / hint for the MIME type. Required when loading a raw base64 string with no data-URL prefix. |
| Options › File name | Text | File name hint — its extension is used to dispatch when no MIME type is known. |
| Options › Include input fields | Toggle | Whether to include the original input fields in the output. Default: Off |
- Binary key / field is the name only, not an expression: for example
content, not{{ $input.content }}. - A data URL already says its type. For a plain base64 string, set MIME type (for example
application/pdf) or a File name such asreport.pdf.
Outputs
Section titled “Outputs”-
Output
Each item has the file’s text in the field you named (default text). With Include input fields on, the incoming fields are kept next to it, which is handy to reuse the file name as Source name on the Indexer.
Dependencies and credentials
Section titled “Dependencies and credentials”None. This node needs no connection and has no slots for other nodes.
Example workflow
Section titled “Example workflow”- Local File Read with Read as
Data URLand Accepted file types.pdf, .mdlets you pick a file. Its content arrives incontentand its name inname. - File Document Loader with Binary key / field
content, Output field nametextand Include input fields on. - Indexer with Input
{{ $input.text }}and Source name{{ $input.name }}. Connect Local Knowledge to Knowledge and Recursive Character Text Splitter to Text Splitter.
Common issues
Section titled “Common issues”- “No source node is connected to this node.” The loader needs an incoming item that carries the file. Connect the node that provides it.
- “No binary attachment or field “…” found on the input item…“. Nothing is stored under Binary key / field. Check the field name in the previous node’s output and type it exactly.
- “Unsupported document type (mimeType: unknown, fileName: unknown)…”. The loader can’t tell the file type. Set MIME type or File name, or convert the file to PDF, HTML or text first. Word and image files are not supported.
- The text is empty for a PDF. The PDF is a scanned image with no text layer. Run it through text recognition first.
Related nodes
Section titled “Related nodes”- Indexer: save the text into a knowledge base.
- PDF Parser: PDF text with per-page options.
- Local File Read: pick a file from your computer.
- URL Document Loader: load a web page instead.