I have a feeling that storing data in a file works only through an inject node that has to be triggered manually.
I would like the data to be stored as soon as new data comes in from a function node though. The trigger node didn't work either.
The msg.payload of a TCP output node should be connected to an file input node, like this:
[{"id":"54b54be5.ca3de4","type":"tcp in","z":"4d18212.60a81e","name":"listening","server":"server","host":"","port":"9100","datamode":"stream","datatype":"utf8","newline":"","topic":"","base64":false,"x":296,"y":206,"wires":[["90434ae1.aa9b98"]],"outputLabels":["node"]},{"id":"90434ae1.aa9b98","type":"file","z":"4d18212.60a81e","name":"","filename":"examplefile","appendNewline":true,"createDir":false,"overwriteFile":"false","x":575,"y":219,"wires":[]}]