Another weekend, some more goodies pushed to the v6.6.0 branch on GitHub in case you want to follow along.
Notable highlight this time is the addition of a new node, uib-save
.
Makes it easy to output files to the folder structure of a uibuilder node.
This can be used for all manner of things.
-
Use with the new
uib-html
node to make a permanent copy of some zero-/low-code output. This means that you could use a no-code flow to create your UI and make it permanent for efficient loading by users. -
Use with the
htmlSend()
front-end function (htmlSend
_uib
cmd from Node-RED) to get a copy of the current state of the UI and save it back to the page file for future use. This would let you effectively cache the very latest UI for super-efficient future loads. Particularly useful if you are doing dynamic updates in front-end code because you can send the updated HTML back to Node-RED and save it automatically. There is also an HTML watch function in the front-end library that would let you automate this from end-to-end. -
Use with HTML like
<input type="file" onchange="upload(this.files)" multiple />
to get one or more files from the user (e.g. images or anything else to save) and save the file permanently such that it can be loaded as a web resource. In other words, allow users to transfer files from their PC to the uibuilder instance web server.
Of course, it also allows you to get files from the Internet or some other process and transfer them automatically to the uibuilder web app.
Files can be of any type, if you want to save a binary such as an image, audio or video, simply send a the file as a buffer in the msg.payload. HTML, CSS, etc can, of course, simply be sent as text.
You could output files manually before of course using Node-RED's file nodes. However, you needed to know where to put things which may not be obvious for novices. Now you don't need to guess or work out the right folder, it is all done for you.
Still only a beta right now with lots of tidying up and error handling, etc. but it basically works - though for now, you have to specify the output folder (relative to the instance root, e.g. "src" to go into the default serving folder) and filename. You will be able to control via msg properties soon.
Another thing that will be added is a flag that will automatically reload connected clients on successful write - great for quick updates to HTML files for example.