node-red-contrib-uibuilder
Version:
Easily create data-driven web UI's for Node-RED. Single- & Multi-page. Multiple UI's. Work with existing web development workflows or mix and match with no-code/low-code features.
148 lines (130 loc) • 5.73 kB
HTML
<script type="text/html" data-help-name="uib-save">
<p>
Save a file into a uibuilder instance folder.
</p>
<p>
<a href="./uibuilder/docs/#/nodes/uib-save" target="_blank">Documentation</a>.
This node has examples in the Node-RED Import Examples library.
</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string|buffer</span></dt>
<dd>
REQUIRED. The data to output to the file.
Use a buffer for binary file types (video, audio, image, etc).
</dd>
<dt>folder <span class="property-type">string</span></dt>
<dd>
If supplied and the folder setting is blank, will be used as the output folder.
</dd>
<dd>
Folder name is <b>ALWAYS</b> relative to the node's instance root folder.
Folder traversal outside of that is not permitted.
</dd>
<dt>fname <span class="property-type">string</span></dt>
<dd>
If supplied and the file name setting is blank, will be used as the output file name.
</dd>
<dd>
<code>msg.fname</code>, <code>msg.filename</code>, or <code>msg.fileName</code> can be used.
</dd>
<dd>
This may contain prefixed sub-folders but cannot use <code>..</code> to prevent folder traversal.
</dd>
</dl>
<h3>Node Settings</h3>
<dl class="message-properties">
<dt>URL <span class="property-type">selection</span></dt>
<dd>
Select the existing uibuilder Node instance via its URL setting.
This cannot be overridden by a msg property at this time.
</dd>
<dd>
Sets the top-most (root) folder that can be written to.
</dd>
<dt>Use pageName <span class="property-type">boolean</span></dt>
<dd>
If set, either <code>msg._uib.pageName</code> or <code>msg._ui.pageName</code> will be used
instead of the file name. The uibuilder node's current served folder will be used for the folder.
</dd>
<dd>
This allows easy overwriting of a uibuilder page's file simply by issuing an <code>htmlSend</code> command
to the front-end and sending the resulting message to this node. See the included examples.
</dd>
<dt>Folder <span class="property-type">string</span></dt>
<dd>
The name of an existing or new folder inside the chosen uibuilder instance root.
</dd>
<dd>
Defaults to <code>src</code>.
</dd>
<dd>
Folder name is <b>ALWAYS</b> relative to the node's instance root folder.
"<code>..</code>" cannot be included in the path to prevent escaping from the instance root.
</dd>
<dd>
If the folder does not exist, an error is generated unless the "Create Folder" flag is ticked.
</dd>
<dd>
<code>msg.folder</code> overrides this as long as this is left blank.
</dd>
<dt>File <span class="property-type">string</span></dt>
<dd>
The name of an existing or new file inside the chosen uibuilder instance root and folder.
</dd>
<dd>
If the file does not exist, it will be created. Otherwise it is silently overwritten.
</dd>
<dd>
Neither "<code>/</code>" or "<code>\</code>" can be included in the file name. The name must be valid for the OS you are using.
</dd>
<dd>
<code>msg.fname</code> will be used if this is left blank.
</dd>
<dd>
This may contain prefixed sub-folders but cannot use <code>..</code> to prevent folder traversal.
</dd>
<dt>Create Folder? <span class="property-type">boolean</span></dt>
<dd>
If set and the given folder name does not exist inside the instance root folder,
the new folder will be automatically created.
</dd>
<dt>Reload? <span class="property-type">boolean</span></dt>
<dd>
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. <code>index.html</code>).
It is mostly useful when testing. Use with caution on a live system.
</dd>
<dt>Encoding <span class="property-type">string</span></dt>
<dd>
Not usable. Future enhancement.
</dd>
<dd>
The optional string encoding to be used when the input data is a string.
It defaults to Node.js's <code>utf8</code>.
See Node.js documentation for what can be provided here.
</dd>
<dt>Mode <span class="property-type">integer</span></dt>
<dd>
Not usable. Future enhancement.
</dd>
<dd>
The optional file output mode. Defaults to <code>0o666</code>
See Node.js documentation for what can be provided here.
</dd>
<dd>
This only impacts newly created files. It is ignored when overwriting existing files.
</dd>
<dd>
On Windows, only the write permission can be set.
</dd>
<dt>Topic <span class="property-type">string</span></dt>
<dd>
Standard optional topic name.
</dd>
<dt>Name <span class="property-type">string</span></dt>
<dd>
Standard optional name. Has no impact other than on the Editor display.
</dd>
</dl>
</script>