knoten / builtin / datatransformation
Convert to File
Turn items into a file (CSV, JSON, text, base64 or binary)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Turn your items into a file (CSV, JSON, text, base64 or binary) that later nodes can upload, attach or save.
What it does
Section titled “What it does”Convert to File builds one file from all incoming items and attaches it to a single output item. It does not save the file anywhere: that is the job of the next node, such as Google Drive, an Http Request body, or a Slack or Gmail attachment.
The file name and type default to sensible values per format (data.csv and text/csv, data.json and application/json, data.txt and text/plain, data.bin and application/octet-stream).
When to use it
Section titled “When to use it”- Upload a scraped table to Google Drive as a real CSV file.
- Attach generated JSON or text to a Slack message or an email.
- Turn a base64 string returned by an API into a proper file.
- To save generated text (CSV, JSON, Markdown) straight to your computer, use Save as File instead.
Inputs and settings
Section titled “Inputs and settings”| Einstellung | Typ | Was es bewirkt |
|---|---|---|
| Format | Choice | The kind of file to produce. Options: CSV, JSON, Text, Base64, Binary. Standard: CSV |
| File name | Text | Name of the produced file. Left empty, a sensible default per format is used. |
| MIME type | Text | Content type recorded on the file. Left empty, a sensible default per format is used. Required to be set explicitly for Base64. |
| Source Field | Text | Field to read from the item. For Text: the text per item. For Base64: the field holding the base64 string. For Binary: the binary slot (defaults to "data") or a field holding the bytes. |
How each Format builds the file:
- CSV: one row per item, written the same way as the CSV node.
- JSON: all items as a neatly indented JSON list.
- Text: one line per item. With Source Field set, each line is that field’s value; otherwise text items are used as is and other items are written as JSON.
- Base64: decodes the base64 text from Source Field (or the
datafield) of the first item. Base64 says nothing about the file type, so set MIME type, for exampleapplication/pdf. - Binary: re-wraps a file already attached to the first item (by default under
data), keeping its own name and type unless you set new ones.
Outputs
Section titled “Outputs”-
Output
Each output item has these fields:
| Field | Typ | What it holds |
|---|---|---|
| fileName | Text | |
| mimeType | Text | |
| format | Text | The format the content was converted from |
| size | Number | |
| $binary | Key-value pairs |
{ "fileName": "…", "mimeType": "…", "format": "…", "size": 0, "$binary": {}}One item that carries the file under data, plus its name, type and size in bytes. In the next node, choose this file as the binary or attachment source.
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”- HTML Extract reads a product table from a page, one item per row.
- Convert to File with Format CSV and File name
products.csv. - Google Drive uploads the file using this node’s file as the source.
Common issues
Section titled “Common issues”- “No items to convert. Connect a node that produces items.” Nothing reached the node. Check that the previous node returns data.
- “Base64 needs a base64 string.” Name the field holding the base64 text in Source Field, or put it in a
datafield, and make sure it is text. - “No binary to wrap.” With Binary, the first item has no attached file. Connect a node that outputs a file, or name the field holding it in Source Field.
- The file opens with the wrong app or type. Set MIME type yourself. This matters most for Base64, which otherwise becomes
application/octet-stream.
Related nodes
Section titled “Related nodes”- Save as File: save generated text to your computer.
- Extract From File: the opposite, read a file back into items.
- Compression: gzip the file before sending it.
- CSV: turn items into CSV text instead of a file.