最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

node-red File读取好保存实例讲解

来源:动视网 责编:小采 时间:2020-11-27 21:50:42
文档

node-red File读取好保存实例讲解

node-red File读取好保存实例讲解:File节点是操作文件的节点 file文件的保存 拖拽 注入节点inject file节点(writes msg.payload to a file)和 debug节点到工作区,并连线 设置file节点的文件路径 windows如果不设置路径,会保存在C:\Users\Administratordocker
推荐度:
导读node-red File读取好保存实例讲解:File节点是操作文件的节点 file文件的保存 拖拽 注入节点inject file节点(writes msg.payload to a file)和 debug节点到工作区,并连线 设置file节点的文件路径 windows如果不设置路径,会保存在C:\Users\Administratordocker


File节点是操作文件的节点

file文件的保存

拖拽 注入节点inject  file节点(writes msg.payload to a file)和 debug节点到工作区,并连线

设置file节点的文件路径

windows如果不设置路径,会保存在C:\Users\Administratordocker容器保存在根目录下

此处文件名我选择 放到data目录下,因为docker容器启动的时候我把/data目录挂载到宿主机上了,方便查看文件

行为有三种,追加至文件  复写文件  删除文件

勾选上创建目录,否则如果目录和文件不存在,需要手动创建

例子:

[{"id":"8828bc.b418","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":[]}]

文件的读取

文件的读取和保存类似

 把上面的file写节点换成file读节点(Reads the contents of a file...)

第一个注入节点inject只是启动发送信号作用

debug区域显示文件内容:

文档

node-red File读取好保存实例讲解

node-red File读取好保存实例讲解:File节点是操作文件的节点 file文件的保存 拖拽 注入节点inject file节点(writes msg.payload to a file)和 debug节点到工作区,并连线 设置file节点的文件路径 windows如果不设置路径,会保存在C:\Users\Administratordocker
推荐度:
标签: File 实例讲解 node
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top