In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about the role of File controls in Node-RED. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
File control
The payload for each message is added to the end of the file, and you can choose to add a newline character between each message. You can configure it to overwrite the entire file instead of adding paragraphs after the file, you can specify the encoding of the data written to the file from the encoding list, and you can configure this node to delete the file.
File in control
Reads the contents of the file in the form of a string or binary buffer. On Windows, you may need to use the escape path delimiter, for example:\\ Users\\ myUser.
You can choose to split the text file into several lines, output one message per line, or split the binary into smaller buffer blocks-the block size depends on the operating system, but is usually 64k (Linux/Mac) or 41k (Windows). If the output format is a string, you can specify the encoding of the input data from the encoding list.
File control uses the
1. Configure the file nod
Drag a file node and make the following edits:
You can see that the figure prompts that the file name should be an absolute path. Therefore, we need to create the corresponding path in the local directory of the computer, copy the path to the file name box and add the file you want to create, such as "F:\ NODE-RED\ file to generate .txt" after the path.
Through this control, files can be appended, overwritten (overwritten), and deleted. Click finish when the configuration is complete.
two。 Configure the inject nod
Drag and drop an inject node to enter the information to be sent. You can choose to send all the formats included in the content sent by the inject node. Select the text column here and enter BearPi. The name is set to Cubs Pie and click finish.
3. Connection node
Connect the inject node to the file node
4. Deployment
Click deploy, and then click the inject node to inject the text column information into the data stream.
At this time, the "file generation .txt" file has been generated under the corresponding path of the computer, and you can see that the text column information "BearPi" has been output in txt by opening the txt file.
The files generated by the file control are not only txt files, but also word or other files. You just need to change the suffix name of the generated file to the suffix name of the corresponding file.
File in control uses the
The functions of the 1.file in control and the inject control are similar, both are input controls. By comparison, you can see that the small square on the left side of the file in control, like the small button on the left side of inject, is used for input trigger.
two。 Configure the file in node to change the inject node name to "trigger". The file in node is configured as shown in the following figure. Enter the .jpg image path in the local computer in the file name field, such as "E:\ 1work\ official account picture\ iot.jpg". Because the file in node enters a picture, the input field is selected as "one Buffer object" or "one Buffer stream".
3. Configure the file nod
Configure the file node used to output the file.
Fill in the path where you want to output the picture in the file name field, such as "F:\ NODE-RED\ IOT.jpg". Because the output file is a picture, the behavior will be selected "copy file", and the configuration details are as shown in the following figure.
4. Click deploy, click the inject node after completion, enter the picture through the file in node, and then output the picture to another designated folder on the computer through the file node. You can see that a picture file with the corresponding name has been generated in the specified folder.
File in control and file control is the same, you can enter files in different formats, here is just a jpg format file as a case demonstration, you can enjoy an open mind, try to find more about the functions of the file control.
This is what the role of the File control in Node-RED is shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.