File節點是操做文件的節點docker
拖拽 注入節點inject file節點(writes msg.payload to a file)和 debug節點到工做區,並連線windows
設置file節點的文件路徑app
此處文件名我選擇 放到data目錄下,由於docker容器啓動的時候我把/data目錄掛載到宿主機上了,方便查看文件ide
行爲有三種,追加至文件 複寫文件 刪除文件spa
勾選上建立目錄,不然若是目錄和文件不存在,須要手動建立debug
例子:3d
[{"id":"898828bc.89b418","type":"inject","z":"6c70a17b.e110f","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":300,"wires":[["1e951d4f.b4d6a3"]]},{"id":"1e951d4f.b4d6a3","type":"file","z":"6c70a17b.e110f","name":"save","filename":"/data/testtimestamp.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":450,"y":300,"wires":[["c27669f0.bef7e8"]]},{"id":"c27669f0.bef7e8","type":"debug","z":"6c70a17b.e110f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":300,"wires":[]}]
文件的讀取和保存相似code
把上面的file寫節點換成file讀節點(Reads the contents of a file...)blog
第一個注入節點inject只是啓動發送信號做用crontab
debug區域顯示文件內容: