Save a file into a uibuilder instance folder.

Documentation. This node has examples in the Node-RED Import Examples library.

Inputs

payload string|buffer
REQUIRED. The data to output to the file. Use a buffer for binary file types (video, audio, image, etc).
folder string
If supplied and the folder setting is blank, will be used as the output folder.
Folder name is ALWAYS relative to the node's instance root folder. Folder traversal outside of that is not permitted.
fname string
If supplied and the file name setting is blank, will be used as the output file name.
This may contain prefixed sub-folders but cannot use .. to prevent folder traversal.

Node Settings

URL selection
Select the existing uibuilder Node instance via its URL setting. This cannot be overridden by a msg property at this time.
Sets the top-most (root) folder that can be written to.
Use pageName boolean
If set, either msg._uib.pageName or msg._ui.pageName will be used instead of the file name. The uibuilder node's current served folder will be used for the folder.
This allows easy overwriting of a uibuilder page's file simply by issuing an htmlSend command to the front-end and sending the resulting message to this node. See the included examples.
Folder string
The name of an existing or new folder inside the chosen uibuilder instance root.
Defaults to src.
Folder name is ALWAYS relative to the node's instance root folder. ".." cannot be included in the path to prevent escaping from the instance root.
If the folder does not exist, an error is generated unless the "Create Folder" flag is ticked.
msg.folder overrides this as long as this is left blank.
File string
The name of an existing or new file inside the chosen uibuilder instance root and folder.
If the file does not exist, it will be created. Otherwise it is silently overwritten.
Neither "/" or "\" can be included in the file name. The name must be valid for the OS you are using.
msg.fname will be used if this is left blank.
This may contain prefixed sub-folders but cannot use .. to prevent folder traversal.
Create Folder? boolean
If set and the given folder name does not exist inside the instance root folder, the new folder will be automatically created.
Reload? boolean
If ticked, any client browser tabs connected to the selected uibuilder node will be reloaded. This may be useful when auto-changing static resource files (e.g. index.html). It is mostly useful when testing. Use with caution on a live system.
Encoding string
Not usable. Future enhancement.
The optional string encoding to be used when the input data is a string. It defaults to Node.js's utf8. See Node.js documentation for what can be provided here.
Mode integer
Not usable. Future enhancement.
The optional file output mode. Defaults to 0o666 See Node.js documentation for what can be provided here.
This only impacts newly created files. It is ignored when overwriting existing files.
On Windows, only the write permission can be set.
Topic string
Standard optional topic name.
Name string
Standard optional name. Has no impact other than on the Editor display.