Writing to a file using a file node
You can append data to a file, overwrite a file or delete a file.
- Open Node-RED.
- Add a file node from the storage category to the workspace.
- Double-click the file node to open the Edit file node dialogue.
- In the text box Filename, specify the file you want to write to (e. g. /home/admin/user).
ATTENTION

Writing to the flash memory of the controller degrades the memory. Do not write to the flash memory too often.
NOTICE

The memory card is accessible at the file path /run/media/mmcblk0p1/.
- In the drop-down list Action, select the writing operation. Choose from:
- append to file: The payload of the received message is appended to the end of the file (useful for logging).
- overwrite file: The data in the file is overwritten with the payload of the received message (useful for binary data e. g. images)
- delete file: The file is deleted whenever the node receives a message
- If you want to add a newline character after each message, enable the check box Add newline (\n) to each payload?.
- If you want to write to a directory that does not yet exist, enable the check box Create directory if it doesn't exist?.
NOTICE

The /home/admin/user directory on the flash memory does not yet exist in the delivery state of the controller.
- Click Done to apply your changes.
- Connect the input of the file node to the node whose messages trigger the writing operation.