File
Node Documentation
Writes msg.payload
to a file, either adding to the end or replacing the existing content. Alternatively, it can delete the file.
Inputs
- filename string
- The name of the file to be updated can be provided in the node configuration, or as a message property. By default it will use
msg.filename
but this can be customised in the node.
- encoding string
- If encoding is configured to be set by msg, then this optional property can set the encoding.
Output
On completion of write, input message is sent to output port.
Details
Each message payload will be added to the end of the file, optionally appending a newline (\n) character between each one.
If msg.filename
is used the file will be closed after every write. For best performance use a fixed filename.
It can be configured to overwrite the entire file rather than append. For example, when writing binary data to a file, such as an image, this option should be used and the option to append a newline should be disabled.
Encoding of data written to a file can be specified from list of encodings.
Alternatively, this node can be configured to delete the file.