1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

move English info text under locales directory

This commit is contained in:
Hiroyasu Nishiyama 2018-11-30 12:50:49 +00:00
parent 8167608f04
commit 5717f75eac
36 changed files with 1789 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="sentiment">
<p>Analyses the chosen property, default <code>payload</code>, and adds a <code>sentiment</code> object.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>sentiment <span class="property-type">object</span></dt>
<dd>contains the resulting AFINN-111 sentiment.</dd>
<dt>sentiment.score <span class="property-type">number</span></dt>
<dd>the sentiment score.</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>overrides <span class="property-type">object</span></dt>
<dd>an object of word score overrides can be supplied - <code>{ word:score,... }</code>.</dd>
</dl>
<h3>Details</h3>
<p>A score greater than zero is positive and less than zero is negative.</p>
<p>The score typically ranges from -5 to +5, but can go higher and lower.</p>
<p>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_blank">the Sentiment docs here</a>.</p>
</script>

View File

@ -0,0 +1,40 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="inject">
<p>Injects a message into a flow either manually or at regular intervals. The message
payload can be a variety of types, including strings, JavaScript objects or the current time.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">various</span></dt>
<dd>The configured payload of the message.</dd>
<dt class="optional">topic <span class="property-type">string</span></dt>
<dd>An optional property that can be configured in the node.</dd>
</dl>
<h3>Details</h3>
<p>The Inject node can initiate a flow with a specific payload value.
The default payload is a timestamp of the current time in millisecs since January 1st, 1970.</p>
<p>The node also supports injecting strings, numbers, booleans, JavaScript objects, or flow/global context values.</p>
<p>By default, the node is triggered manually by clicking on its button within the editor. It can also be set to
inject at regular intervals or according to a schedule.</p>
<p>It can also be configured to inject once each time the flows are started.</p>
<p>The maximum <i>Interval</i> that can be specified is about 596 hours / 24 days. However if you are looking at intervals
greater than one day you should consider using a scheduler node that can cope with power outages and restarts.</p>
<p><b>Note</b>: The <i>"Interval between times"</i> and <i>"at a specific time"</i> options use the standard cron system.
This means that 20 minutes will be at the next hour, 20 minutes past and 40 minutes past - not in 20 minutes time.
If you want every 20 minutes from now - use the <i>"interval"</i> option.</p>
<p><b>Note</b>: To include a newline in a string you must use a Function node to create the payload.</p>
</script>

View File

@ -0,0 +1,41 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="catch">
<p>Catch errors thrown by nodes on the same tab.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>error.message <span class="property-type">string</span></dt>
<dd>the error message.</dd>
<dt>error.source.id <span class="property-type">string</span></dt>
<dd>the id of the node that threw the error.</dd>
<dt>error.source.type <span class="property-type">string</span></dt>
<dd>the type of the node that threw the error.</dd>
<dt>error.source.name <span class="property-type">string</span></dt>
<dd>the name, if set, of the node that threw the error.</dd>
</dl>
<h3>Details</h3>
<p>If a node throws an error whilst handling a message, the flow will typically
halt. This node can be used to catch those errors and handle them with a
dedicated flow.</p>
<p>By default, the node will catch errors thrown by any node on the same tab. Alternatively
it can be targetted at specific nodes.</p>
<p>When an error is thrown, all matching catch nodes will receive the message.</p>
<p>If an error is thrown within a subflow, the error will get handled by any
catch nodes within the subflow. If none exists, the error will be propagated
up to the tab the subflow instance is on.</p>
<p>If the message already has a <code>error</code> property, it is copied to <code>_error</code>.</p>
</script>

View File

@ -0,0 +1,34 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="status">
<p>Report status messages from other nodes on the same tab.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>status.text <span class="property-type">string</span></dt>
<dd>the status text.</dd>
<dt>status.source.type <span class="property-type">string</span></dt>
<dd>the type of the node that reported status.</dd>
<dt>status.source.id <span class="property-type">string</span></dt>
<dd>the id of the node that reported status.</dd>
<dt>status.source.name <span class="property-type">string</span></dt>
<dd>the name, if set, of the node that reported status.</dd>
</dl>
<h3>Details</h3>
<p>This node does not produce a <code>payload</code>.</p>
<p>By default the node reports status for all nodes on the same workspace tab.
It can be configured to selectively report status for individual nodes.</p>
</script>

View File

@ -0,0 +1,26 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="debug">
<p>Displays selected message properties in the debug sidebar tab and optionally the runtime log. By default it displays <code>msg.payload</code>.</p>
<h3>Details</h3>
<p>The debug sidebar provides a structured view of the messages it is sent, making it easier to understand their structure.</p>
<p>JavaScript objects and arrays can be collapsed and expanded as required. Buffer objects can be displayed as raw data or as a string if possible.</p>
<p>Alongside each message, the debug sidebar includes information about the time the message was received, the node that sent it and the type of the message.
Clicking on the source node id will reveal that node within the workspace.</p>
<p>The button on the node can be used to enable or disable its output. It is recommended to disable or remove any Debug nodes that are not being used.</p>
<p>The node can also be configured to send all messages to the runtime log, or to send short (32 characters) to the status text under the debug node.</p>
</script>

View File

@ -0,0 +1,37 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="link in">
<p>Create virtual wires between flows.</p>
<h3>Details</h3>
<p>The node can be connected to any <code>link out</code> node that exists on any tab.
Once connected, they behave as if they were wired together.</p>
<p>The wires between link nodes are only displayed when a link node is selected.
If there are any wires to other tabs, a virtual node is shown that can be clicked
on to jump to the appropriate tab.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script>
<script type="text/x-red" data-help-name="link out">
<p>Create virtual wires between flows.</p>
<h3>Details</h3>
<p>The node can be connected to any <code>link in</code> node that exists on any tab.
Once connected, they behave as if they were wired together.</p>
<p>The wires between link nodes are only displayed when a link node is selected.
If there are any wires to other tabs, a virtual node is show that can be clicked
on to jump to the appropriate tab.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script>

View File

@ -0,0 +1,83 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="exec">
<p>Runs a system command and returns its output.</p>
<p>The node can be configured to either wait until the command completes, or to
send its output as the command generates it.</p>
<p>The command that is run can be configured in the node or provided by the received
message.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">payload <span class="property-type">string</span></dt>
<dd>if configured to do so, will be appended to the executed command.</dd>
<dt class="optional">kill <span class="property-type">string</span></dt>
<dd>the type of kill signal to send an existing exec node process.</dd>
<dt class="optional">pid <span class="property-type">number|string</span></dt>
<dd>the process ID of an existing exec node process to kill.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard output of the command.</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">object</span></dt>
<dd>exec mode only, a copy of the return code object (also available on port 3)</dd>
</dl>
</li>
<li>Standard error
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">object</span></dt>
<dd>exec mode only, a copy of the return code object (also available on port 3)</dd>
</dl>
</li>
<li>Return code
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>an object containing the return code, and possibly <code>message</code>, <code>signal</code> properties.</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>By default uses the <code>exec</code> system call which calls the command, waits for it to complete, and then
returns the output. For example a successful command should have a return code of <code>{ code: 0 }</code>.</p>
<p>Optionally can use <code>spawn</code> instead, which returns the output from stdout and stderr
as the command runs, usually one line at a time. On completion it then returns an object
on the 3rd port. For example, a successful command should return <code>{ code: 0 }</code>.</p>
<p>Errors may return extra information on the 3rd port <code>msg.payload</code>, such as a <code>message</code> string,
<code>signal</code> string.</p>
<p>The command that is run is defined within the node, with an option to append <code>msg.payload</code> and a further set of parameters.</p>
<p>Commands or parameters with spaces should be enclosed in quotes - <code>"This is a single parameter"</code></p>
<p>The returned <code>payload</code> is usually a <i>string</i>, unless non-UTF8 characters are detected, in which
case it is a <i>buffer</i>.</p>
<p>The node&apos;s status icon and PID will be visible while the node is active. Changes to this can be read by the <code>Status</code> node.</p>
<h4>Killing processes</h4>
<p>Sending <code>msg.kill</code> will kill a single active process. <code>msg.kill</code> should be a string containing
the type of signal to be sent, for example, <code>SIGINT</code>, <code>SIGQUIT</code> or <code>SIGHUP</code>.
Defaults to <code>SIGTERM</code> if set to an empty string.</p>
<p>If the node has more than one process running then <code>msg.pid</code> must also be set with the value of the PID to be killed.</p>
<p>If a value is provided in the <code>Timeout</code> field then, if the process has not completed when the specified number of seconds has elapsed, the process will be killed automatically</p>
<p>Tip: if running a Python app you may need to use the <code>-u</code> parameter to stop the output being buffered.</p>
</script>

View File

@ -0,0 +1,58 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="function">
<p>A JavaScript function block to run against the messages being received by the node.</p>
<p>The messages are passed in as a JavaScript object called <code>msg</code>.</p>
<p>By convention it will have a <code>msg.payload</code> property containing
the body of the message.</p>
<p>The function is expected to return a message object (or multiple message objects), but can choose
to return nothing in order to halt a flow.</p>
<h3>Details</h3>
<p>See the <a target="_blank" href="http://nodered.org/docs/writing-functions.html">online documentation</a>
for more information on writing functions.</p>
<h4>Sending messages</h4>
<p>The function can either return the messages it wants to pass on to the next nodes
in the flow, or can call <code>node.send(messages)</code>.</p>
<p>It can return/send:</p>
<ul>
<li>a single message object - passed to nodes connected to the first output</li>
<li>an array of message objects - passed to nodes connected to the corresponding outputs</li>
</ul>
<p>If any element of the array is itself an array of messages, multiple
messages are sent to the corresponding output.</p>
<p>If null is returned, either by itself or as an element of the array, no
message is passed on.</p>
<h4>Logging and Error Handling</h4>
<p>To log any information, or report an error, the following functions are available:</p>
<ul>
<li><code>node.log("Log message")</code></li>
<li><code>node.warn("Warning")</code></li>
<li><code>node.error("Error")</code></li>
</ul>
</p>
<p>The Catch node can also be used to handle errors. To invoke a Catch node,
pass <code>msg</code> as a second argument to <code>node.error</code>:</p>
<pre>node.error("Error",msg);</pre>
<h4>Accessing Node Information</h4>
<p>In the function block, id and name of the node can be referenced using the following properties:</p>
<ul>
<li><code>node.id</code> - id of the node</li>
<li><code>node.name</code> - name of the node</li>
</ul>
<h4>Using environment variables</h4>
<p>Environment variables can be accessed using <code>env.get("MY_ENV_VAR")</code>.</p>
</script>

View File

@ -0,0 +1,51 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="template">
<p>Sets a property based on the provided template.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>A msg object containing information to populate the template.</dd>
<dt class="optional">template <span class="property-type">string</span></dt>
<dd>A template to be populated from msg.payload. If not configured in the edit panel,
this can be set as a property of msg.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>a msg with a property set by populating the configured template with properties from the incoming msg.</dd>
</dl>
<h3>Details</h3>
<p>By default this uses the <i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>
format, but this can be switched off if required.</p>
<p>For example, when a template of:
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
<p>receives a message containing:
<pre>{
date: "Monday"
payload: {
name: "Fred",
}
}</pre>
<p>The resulting property will be:
<pre>Hello Fred. Today is Monday</pre>
<p>It is possible to use a property from the flow context or global context. Just use <code>{{flow.name}}</code> or
<code>{{global.name}}</code>, or for persistable store <code>store</code> use <code>{{flow[store].name}}</code> or
<code>{{global[store].name}}</code>.
<p><b>Note: </b>By default, <i>mustache</i> will escape any HTML entities in the values it substitutes.
To prevent this, use <code>{{{triple}}}</code> braces.
</script>

View File

@ -0,0 +1,45 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="delay">
<p>Delays each message passing through the node or limits the rate at which they can pass.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">delay <span class="property-type">number</span></dt>
<dd>Sets the delay, in milliseconds, to be applied to the message. This
option only applies if the node is configured to allow the message to
override the configured default delay interval.</dd>
<dt class="optional">reset</dt>
<dd>If the received message has this property set to any value, all
outstanding messages held by the node are cleared without being sent.</dd>
<dt class="optional">flush</dt>
<dd>If the received message has this property set to any value, all
outstanding messages held by the node are sent immediately.</dd>
</dl>
<h3>Details</h3>
<p>When configured to delay messages, the delay interval can be a fixed value,
a random value within a range or dynamically set for each message.</p>
<p>When configured to rate limit messages, their delivery is spread across
the configured time period. The status shows the number of messages currently in the queue.
It can optionally discard intermediate messages as they arrive.</p>
</p>
<p>The rate limiting can be applied to all messages, or group them according to
their <code>msg.topic</code> value. When grouping, intermerdiate messages are
automatically dropped. At each time interval, the node can either release
the most recent message for all topics, or release the most recent message
for the next topic.
</p>
</script>

View File

@ -0,0 +1,45 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="trigger">
<p>When triggered, can send a message, and then optionally a second message, unless extended or reset.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">reset</dt>
<dd>If a message is received with this property, any timeout or repeat
currently in progress will be cleared and no message triggered.</dd>
</dl>
<h3>Details</h3>
<p>This node can be used to create a timeout within a flow. By default, when
it receives a message, it sends on a message with a <code>payload</code> of <code>1</code>.
It then waits 250ms before sending a second message with a <code>payload</code> of <code>0</code>.
This could be used, for example, to blink an LED attached to a Raspberry Pi GPIO pin.</p>
<p>The payloads of each message sent can be configured to a variety of values, including
the option to not send anything. For example, setting the initial message to <i>nothing</i> and
selecting the option to extend the timer with each received message, the node will
act as a watchdog timer; only sending a message if nothing is received within the
set interval.</p>
<p>If set to a <i>string</i> type, the node supports the mustache template syntax.</p>
<p>If the node receives a message with a <code>reset</code> property, or a <code>payload</code>
that matches that configured in the node, any timeout or repeat currently in
progress will be cleared and no message triggered.</p>
<p>The node can be configured to resend a message at a regular interval until it
is reset by a received message.</p>
<p>Optionally, the node can be configured to treat messages with <code>msg.topic</code> as if they
are separate streams.</p>
</script>

View File

@ -0,0 +1,22 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="comment">
<p>A node you can use to add comments to your flows.</p>
<h3>Details</h3>
<p>The edit panel will accept Markdown syntax. The text will be rendered into
this information side panel.</p>
</script>

View File

@ -0,0 +1,28 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="unknown">
<p>This node is a type unknown to your installation of Node-RED.</p>
<h3>Details</h3>
<p><i>If you deploy with the node in this state, its configuration will be preserved, but
the flow will not start until the missing type is installed.</i></p>
<p>Use the <code>Menu - Manage Palette</code> option
to search for and install nodes, or <b>npm install &lt;module&gt;</b> to
install, any missing modules and restart Node-RED and reimport the nodes.</p>
<p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up
log for any error messages associated with the missing node type.</p>
<p>Otherwise, you should contact the author of the flow to obtain a copy of the missing node type.</p>
</script>

View File

@ -0,0 +1,75 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="rpi-gpio in">
<p>Raspberry Pi input node. Generates a <code>msg.payload</code> with either a
0 or 1 depending on the state of the input pin.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>the payload will be a 1 or a 0.</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>the topic will be set to <code>pi/{the pin number}</code>.</dd>
</dl>
<h3>Details</h3>
<p>You may also enable the input pullup resistor or the pulldown resistor.</p>
<p>Requires the RPi.GPIO python library version 0.5.10 (or better) in order to work.</p>
</script>
<script type="text/x-red" data-help-name="rpi-gpio out">
<p>Raspberry Pi output node. Can be used in Digital or PWM modes.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number | string | boolean</span></dt>
</dl>
<h3>Details</h3>
<p>Digital mode - expects a <code>msg.payload</code> with either a 0 or 1 (or true or false),
and will set the selected physical pin high or low depending on the value passed in.</p>
<p>The initial value of the pin at deploy time can also be set to 0 or 1.</p>
<p>PWM mode - expects an input value of a number 0 - 100. It can be floating point.</p>
<p>PWM mode can be used to drive a servo using input values between 10 and 20 only,
but will accept floating point values.
The GPIO2 pin is best for this as it uses hardware to do the PWM. For better servo support
consider the alternative node-red-node-pi-gpiod node.</p>
<p>Requires the RPi.GPIO python library version 0.5.10 (or better) in order to work.</p>
</script>
<script type="text/x-red" data-help-name="rpi-mouse">
<p>Raspberry Pi mouse button node. Requires a USB mouse.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>1 or 0 when the selected mouse button is pressed and released.</dd>
<dt>button <span class="property-type">number</span></dt>
<dd>1, 2, 4 corresponding to left, right and middle buttons, so you
can work out which button or combination was pressed.</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>set to <code>pi/mouse</code></dd>
</dl>
</script>
<script type="text/x-red" data-help-name="rpi-keyboard">
<p>Raspberry Pi keyboard handling node. Requires a USB keyboard.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>contains the keycode value</dd>
<dt>action <span class="property-type">string</span></dt>
<dd>set to "up", "down", or "repeat"</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>set to <code>pi/key</code></dd>
</dl>
</script>

View File

@ -0,0 +1,19 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="tls-config">
<p>Configuration options for TLS connections.</p>
</script>

View File

@ -0,0 +1,22 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="http proxy">
<p>Configuration options for HTTP proxy.</p>
<h3>Details</h3>
<p>When accessing to the host in the ignored host list, no proxy will be used.</p>
</script>

View File

@ -0,0 +1,84 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="mqtt in">
<p>Connects to a MQTT broker and subscribes to messages from the specified topic.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd>a string unless detected as a binary buffer.</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>the MQTT topic, uses / as a hierarchy separator.</dd>
<dt>qos <span class="property-type">number</span> </dt>
<dd>0, fire and forget - 1, at least once - 2, once and once only.</dd>
<dt>retain <span class="property-type">boolean</span></dt>
<dd>true indicates the message was retained and may be old.</dd>
</dl>
<h3>Details</h3>
The subscription topic can include MQTT wildcards, + for one level, # for multiple levels.</p>
<p>This node requires a connection to a MQTT broker to be configured. This is configured by clicking
the pencil icon.</p>
<p>Several MQTT nodes (in or out) can share the same broker connection if required.</p>
</script>
<script type="text/x-red" data-help-name="mqtt out">
<p>Connects to a MQTT broker and publishes messages.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd> most users prefer simple text payloads, but binary buffers can also be published.</dd>
<dt class="optional">topic <span class="property-type">string</span></dt>
<dd> the MQTT topic to publish to.</dd>
<dt class="optional">qos <span class="property-type">number</span></dt>
<dd>0, fire and forget - 1, at least once - 2, once and once only. Default 0.</dd>
<dt class="optional">retain <span class="property-type">boolean</span></dt>
<dd>set to true to retain the message on the broker. Default false.</dd>
</dl>
<h3>Details</h3>
<code>msg.payload</code> is used as the payload of the published message.
If it contains an Object it will be converted to a JSON string before being sent.
If it contains a binary Buffer the message will be published as-is.</p>
<p>The topic used can be configured in the node or, if left blank, can be set by <code>msg.topic</code>.</p>
<p>Likewise the QoS and retain values can be configured in the node or, if left
blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively. To clear a previously
retained topic from the broker, send a blank message to that topic with the retain flag set.</p>
<p>This node requires a connection to a MQTT broker to be configured. This is configured by clicking
the pencil icon.</p>
<p>Several MQTT nodes (in or out) can share the same broker connection if required.</p>
</script>
<script type="text/x-red" data-help-name="mqtt-broker">
<p>Configuration for a connection to an MQTT broker.</p>
<p>This configuration will create a single connection to the broker which can
then be reused by <code>MQTT In</code> and <code>MQTT Out</code> nodes.</p>
<p>The node will generate a random Client ID if one is not set and the
node is configured to use a Clean Session connection. If a Client ID is set,
it must be unique to the broker you are connecting to.</p>
<h4>Birth Message</h4>
<p>This is a message that will be published on the configured topic whenever the
connection is established.</p>
<h4>Close Message</h4>
<p>This is a message that will be published on the configured topic before the
connection is closed normally, either by re-deploying the node, or by shutting down.</p>
<h4>Will Message</h4>
<p>This is a message that will be published by the broker in the event the node
unexpectedly loses its connection.</p>
<h4>WebSockets</h4>
<p>The node can be configured to use a WebSocket connection. To do so, the Server
field should be configured with a full URI for the connection. For example:</p>
<pre>ws://example.com:4000/mqtt</pre>
</script>

View File

@ -0,0 +1,100 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="http in">
<p>Creates an HTTP end-point for creating web services.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload</dt>
<dd>For a GET request, contains an object of any query string parameters.
Otherwise, contains the body of the HTTP request.</dd>
<dt>req<span class="property-type">object</span></dt>
<dd>An HTTP request object. This object contains multiple properties that
provide information about the request.
<ul>
<li><code>body</code> - the body of the incoming request. The format
will depend on the request.</li>
<li><code>headers</code> - an object containing the HTTP request headers.</li>
<li><code>query</code> - an object containing any query string parameters.</li>
<li><code>params</code> - an object containing any route parameters.</li>
<li><code>cookies</code> - an object containing the cookies for the request.</li>
<li><code>files</code> - if enabled within the node, an object containing
any files uploaded as part of a POST request.</li>
</ul>
</dd>
<dt>res<span class="property-type">object</span></dt>
<dd>An HTTP response object. This property should not be used directly;
the <code>HTTP Response</code> node documents how to respond to a request.
This property must remain attached to the message passed to the response node.</dd>
</dl>
<h3>Details</h3>
<p>The node will listen on the configured path for requests of a particular type.
The path can be fully specified, such as <code>/user</code>, or include
named parameters that accept any value, such as <code>/user/:name</code>.
When named parameters are used, their actual value in a request can be accessed under <code>msg.req.params</code>.</p>
<p>For requests that include a body, such as a POST or PUT, the contents of
the request is made available as <code>msg.payload</code>.</p>
<p>If the content type of the request can be determined, the body will be parsed to
any appropriate type. For example, <code>application/json</code> will be parsed to
its JavaScript object representation.</p>
<p><b>Note:</b> this node does not send any response to the request. The flow
must include an HTTP Response node to complete the request.</p>
</script>
<script type="text/x-red" data-help-name="http response">
<p>Sends responses back to requests received from an HTTP Input node.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>The body of the response.</dd>
<dt class="optional">statusCode <span class="property-type">number</span></dt>
<dd>If set, this is used as the response status code. Default: 200.</dd>
<dt class="optional">headers <span class="property-type">object</span></dt>
<dd>If set, provides HTTP headers to include in the response.</dd>
<dt class="optional">cookies <span class="property-type">object</span></dt>
<dd>If set, can be used to set or delete cookies.</dd>
</dl>
<h3>Details</h3>
<p>The <code>statusCode</code> and <code>headers</code> can also be set within
the node itself. If a property is set within the node, it cannot be overridden
by the corresponding message property.</p>
<h4>Cookie handling</h4>
<p>The <code>cookies</code> property must be an object of name/value pairs.
The value can be either a string to set the value of the cookie with default
options, or it can be an object of options.<p>
<p>The following example sets two cookies - one called <code>name</code> with
a value of <code>nick</code>, the other called <code>session</code> with a
value of <code>1234</code> and an expiry set to 15 minutes.</p>
<pre>
msg.cookies = {
name: 'nick',
session: {
value: '1234',
maxAge: 900000
}
}</pre>
<p>The valid options include:</p>
<ul>
<li><code>domain</code> - (String) domain name for the cookie</li>
<li><code>expires</code> - (Date) expiry date in GMT. If not specified or set to 0, creates a session cookie</li>
<li><code>maxAge</code> - (String) expiry date as relative to the current time in milliseconds</li>
<li><code>path</code> - (String) path for the cookie. Defaults to /</li>
<li><code>value</code> - (String) the value to use for the cookie</li>
</ul>
<p>To delete a cookie, set its <code>value</code> to <code>null</code>.</p>
</script>

View File

@ -0,0 +1,80 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="http request">
<p>Sends HTTP requests and returns the response.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">url <span class="property-type">string</span></dt>
<dd>If not configured in the node, this optional property sets the url of the request.</dd>
<dt class="optional">method <span class="property-type">string</span></dt>
<dd>If not configured in the node, this optional property sets the HTTP method of the request.
Must be one of <code>GET</code>, <code>PUT</code>, <code>POST</code>, <code>PATCH</code> or <code>DELETE</code>.</dd>
<dt class="optional">headers <span class="property-type">object</span></dt>
<dd>Sets the HTTP headers of the request.</dd>
<dt class="optional">cookies <span class="property-type">object</span></dt>
<dd>If set, can be used to send cookies with the request.</dd>
<dt class="optional">payload</dt>
<dd>Sent as the body of the request.</dd>
<dt class="optional">rejectUnauthorized</dt>
<dd>If set to <code>false</code>, allows requests to be made to https sites that use
self signed certificates.</dd>
<dt class="optional">followRedirects</dt>
<dd>If set to <code>false</code> prevent following Redirect (HTTP 301).<code>true</code> by default</dd>
<dt class="optional">requestTimeout</dt>
<dd>If set to a positive number, will override the globally set <code>httpRequestTimeout</code> parameter.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | object | buffer</span></dt>
<dd>The body of the response. The node can be configured to return the body
as a string, attempt to parse it as a JSON string or leave it as a
binary buffer.</dd>
<dt>statusCode <span class="property-type">number</span></dt>
<dd>The status code of the response, or the error code if the request could not be completed.</dd>
<dt>headers <span class="property-type">object</span></dt>
<dd>An object containing the response headers.</dd>
<dt>responseUrl <span class="property-type">string</span></dt>
<dd>In case any redirects occurred while processing the request, this property is the final redirected url.
Otherwise, the url of the original request.</dd>
<dt>responseCookies <span class="property-type">object</span></dt>
<dd>If the response includes cookies, this propery is an object of name/value pairs for each cookie.</dd>
</dl>
<h3>Details</h3>
<p>When configured within the node, the URL property can contain <a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache-style</a> tags. These allow the
url to be constructed using values of the incoming message. For example, if the url is set to
<code>example.com/{{{topic}}}</code>, it will have the value of <code>msg.topic</code> automatically inserted.
Using {{{...}}} prevents mustache from escaping characters like / & etc.</p>
<p><b>Note</b>: If running behind a proxy, the standard <code>http_proxy=...</code> environment variable should be set and Node-RED restarted, or use Proxy Configuration. If Proxy Configuration was set, the configuration take precedence over environment variable.</p>
<h4>Using multiple HTTP Request nodes</h4>
<p>In order to use more than one of these nodes in the same flow, care must be taken with
the <code>msg.headers</code> property. The first node will set this property with
the response headers. The next node will then use those headers for its request - this
is not usually the right thing to do. If <code>msg.headers</code> property is left unchanged
between nodes, it will be ignored by the second node. To set custom headers, <code>msg.headers</code>
should first be deleted or reset to an empty object: <code>{}</code>.
<h4>Cookie handling</h4>
<p>The <code>cookies</code> property passed to the node must be an object of name/value pairs.
The value can be either a string to set the value of the cookie or it can be an
object with a single <code>value</code> property.<p>
<p>Any cookies returned by the request are passed back under the <code>responseCookies</code> property.</p>
<h4>Content type handling</h4>
<p>If <code>msg.payload</code> is an Object, the node will automatically set the content type
of the request to <code>application/json</code> and encode the body as such.</p>
<p>To encode the request as form data, <code>msg.headers["content-type"]</code> should be set to <code>application/x-www-form-urlencoded</code>.</p>
</script>

View File

@ -0,0 +1,67 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="websocket in">
<p>WebSocket input node.</p>
<p>By default, the data received from the WebSocket will be in <code>msg.payload</code>.
The socket can be configured to expect a properly formed JSON string, in which
case it will parse the JSON and send on the resulting object as the entire message.</p>
</script>
<script type="text/x-red" data-help-name="websocket out">
<p>WebSocket out node.</p>
<p>By default, <code>msg.payload</code> will be sent over the WebSocket. The socket
can be configured to encode the entire <code>msg</code> object as a JSON string and send that
over the WebSocket.</p>
<p>If the message arriving at this node started at a WebSocket In node, the message
will be sent back to the client that triggered the flow. Otherwise, the message
will be broadcast to all connected clients.</p>
<p>If you want to broadcast a message that started at a WebSocket In node, you
should delete the <code>msg._session</code> property within the flow.</p>
</script>
<script type="text/x-red" data-help-name="websocket-listener">
<p>This configuration node creates a WebSocket Server endpoint using the specified path.</p>
</script>
<!-- WebSocket Client configuration node -->
<script type="text/x-red" data-template-name="websocket-client">
<div class="form-row">
<label for="node-config-input-path"><i class="fa fa-bookmark"></i> <span data-i18n="websocket.label.url"></span></label>
<input id="node-config-input-path" type="text" placeholder="ws://example.com/ws">
</div>
<div class="form-row node-config-row-tls hide">
<label for="node-config-input-tls" data-i18n="httpin.tls-config"></label>
<input type="text" id="node-config-input-tls">
</div>
<div class="form-row">
<label for="node-config-input-wholemsg" data-i18n="websocket.sendrec"></label>
<select type="text" id="node-config-input-wholemsg" style="width: 70%;">
<option value="false" data-i18n="websocket.payload"></option>
<option value="true" data-i18n="websocket.message"></option>
</select>
</div>
<div class="form-tips">
<p><span data-i18n="[html]websocket.tip.url1"></span></p>
<span data-i18n="[html]websocket.tip.url2"></span>
</div>
</script>
<script type="text/x-red" data-help-name="websocket-client">
<p>This configuration node connects a WebSocket client to the specified URL.</p>
</script>

View File

@ -0,0 +1,30 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="watch">
<p>Watches a directory or file for changes.</p>
<p>You can enter a list of comma separated directories and/or files. You will
need to put quotes "..." around any that have spaces in.</p>
<p>On Windows you must use double back-slashes \\ in any directory names.</p>
<p>The full filename of the file that actually changed is put into <code>msg.payload</code> and <code>msg.filename</code>,
while a stringified version of the watch list is returned in <code>msg.topic</code>.</p>
<p><code>msg.file</code> contains just the short filename of the file that changed.
<code>msg.type</code> has the type of thing changed, usually <i>file</i> or <i>directory</i>,
while <code>msg.size</code> holds the file size in bytes.</p>
<p>Of course in Linux, <i>everything</i> is a file and thus can be watched...</p>
<p><b>Note: </b>The directory or file must exist in order to be watched. If the file
or directory gets deleted it may no longer be monitored even if it gets re-created.</p>
</script>

View File

@ -0,0 +1,45 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="tcp in">
<p>Provides a choice of TCP inputs. Can either connect to a remote TCP port,
or accept incoming connections.</p>
<p><b>Note: </b>On some systems you may need root or administrator access
to access ports below 1024.</p>
</script>
<script type="text/x-red" data-help-name="tcp out">
<p>Provides a choice of TCP outputs. Can either connect to a remote TCP port,
accept incoming connections, or reply to messages received from a TCP In node.</p>
<p>Only the <code>msg.payload</code> is sent.</p>
<p>If <code>msg.payload</code> is a string containing a Base64 encoding of binary
data, the Base64 decoding option will cause it to be converted back to binary
before being sent.</p>
<p>If <code>msg._session</code> is not present the payload is
sent to <b>all</b> connected clients.</p>
<p><b>Note: </b>On some systems you may need root or administrator access
to access ports below 1024.</p>
</script>
<script type="text/x-red" data-help-name="tcp request">
<p>A simple TCP request node - sends the <code>msg.payload</code> to a server tcp port and expects a response.</p>
<p>Connects, sends the "request", and reads the "response". It can either count a number of
returned characters into a fixed buffer, match a specified character before returning,
wait a fixed timeout from first reply and then return, sit and wait for data, or send then close the connection
immediately, without waiting for a reply.</p>
<p>The response will be output in <code>msg.payload</code> as a buffer, so you may want to .toString() it.</p>
<p>If you leave tcp host or port blank they must be set by using the <code>msg.host</code> and <code>msg.port</code> properties.</p>
</script>

View File

@ -0,0 +1,31 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="udp in">
<p>A UDP input node, that produces a <code>msg.payload</code> containing a
Buffer, string, or base64 encoded string. Supports multicast.</p>
<p>It also provides <code>msg.ip</code> and <code>msg.port</code> set to the
ip address and port from which the message was received.</p>
<p><b>Note</b>: On some systems you may need root or administrator access to use
ports below 1024 and/or broadcast.</p>
</script>
<script type="text/x-red" data-help-name="udp out">
<p>This node sends <code>msg.payload</code> to the designated UDP host and port. Supports multicast.</p>
<p>You may also use <code>msg.ip</code> and <code>msg.port</code> to set the destination values, but the statically configured values have precedence.</p>
<p>If you select broadcast either set the address to the local broadcast ip address, or maybe try 255.255.255.255, which is the global broadcast address.</p>
<p><b>Note</b>: On some systems you may need to be root to use ports below 1024 and/or broadcast.</p>
</script>

View File

@ -0,0 +1,51 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="switch">
<p>Route messages based on their property values or sequence position.</p>
<h3>Details</h3>
<p>When a message arrives, the node will evaluate each of the defined rules
and forward the message to the corresponding outputs of any matching rules.</p>
<p>Optionally, the node can be set to stop evaluating rules once it finds one
that matches.</p>
<p>The rules can be evaluated against an individual message property, a flow or global
context property or the result of a JSONata expression.</p>
<h4>Rules</h4>
<p>There are four types of rule:</p>
<ol>
<li><b>Value</b> rules are evaluated against the configured property</li>
<li><b>Sequence</b> rules can be used on message sequences, such as those
generated by the Split node</li>
<li>A JSONata <b>Expression</b> can be provided that will be evaluated
against the whole message and will match if the expression returns
a true value.</li>
<li>An <b>Otherwise</b> rule can be used to match if none of the preceeding
rules have matched.</li>
</ol>
<h4>Notes</h4>
<p>The <code>is true/false</code> and <code>is null</code> rules perform strict
comparisons against those types. They do not convert between types.</p>
<p>The <code>is empty</code> rule passes for Strings, Arrays and Buffers that have
a length of 0, or Objects that have no properties. It does not pass for <code>null</code>
or <code>undefined</code> values.</p>
<h4>Handling message sequences</h4>
<p>By default, the node does not modify the <code>msg.parts</code> property of messages
that are part of a sequence.</p>
<p>The <b>recreate message sequences</b> option can be enabled to generate new message sequences
for each rule that matches. In this mode, the node will buffer the entire incoming
sequence before sending the new sequences on. The runtime setting <code>nodeMessageBufferMaxLength</code>
can be used to limit how many messages nodes will buffer.</p>
</script>

View File

@ -0,0 +1,39 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="change">
<p>Set, change, delete or move properties of a message, flow context or global context.</p>
<p>The node can specify multiple rules that will be applied in the order they are defined.</p>
<h3>Details</h3>
<p>The available operations are:</p>
<dl class="message-properties">
<dt>Set</dt>
<dd>set a property. The value can be a variety of different types, or
can be taken from an existing message or context property.</dd>
<dt>Change</dt>
<dd>search &amp; replace parts of the property. If regular expressions
are enabled, the "replace with" property can include capture groups, for
example <code>$1</code>. Replace will only change the type if there
is a complete match.</dd>
<dt>Delete</dt>
<dd>delete a property.</dd>
<dt>Move</dt>
<dd>move or rename a property.</dd>
</dl>
<p>The "expression" type uses the <a href="http://jsonata.org/" target="_new">JSONata</a>
query and expression language.
</p>
</script>

View File

@ -0,0 +1,37 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="range">
<p>Maps a numeric value to a different range.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>The payload <i>must</i> be a number. Anything else will try to be
parsed into a number and rejected if that fails.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>The value mapped to the new range.</dd>
</dl>
<h3>Details</h3>
<p>This node will linearly scale the received value. By default, the result
is not constrained to the range defined in the node.</p>
<p><i>Scale and limit to target range</i> means that the result will never be outside
the range specified within the result range.</p>
<p><i>Scale and wrap within the target range</i> means that the result will
be wrapped within the result range.</p>
</script>

View File

@ -0,0 +1,165 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="split">
<p>Splits a message into a sequence of messages.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string | array | buffer</span></dt>
<dd>The behaviour of the node is determined by the type of <code>msg.payload</code>:
<ul>
<li><b>string</b>/<b>buffer</b> - the message is split using the specified character (default: <code>\n</code>), buffer sequence or into fixed lengths.</li>
<li><b>array</b> - the message is split into either individual array elements, or arrays of a fixed-length.</li>
<li><b>object</b> - a message is sent for each key/value pair of the object.</li>
</ul>
</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>parts<span class="property-type">object</span></dt>
<dd>This property contains information about how the message was split from
the original message. If passed to the <b>join</b> node, the sequence can be
reassembled into a single message. The property has the following properties:
<ul>
<li><code>id</code> - an identifier for the group of messages</li>
<li><code>index</code> - the position within the group</li>
<li><code>count</code> - if known, the total number of messages in the group. See 'streaming mode' below.</li>
<li><code>type</code> - the type of message - string/array/object/buffer</li>
<li><code>ch</code> - for a string or buffer, the data used to the split the message as either the string or an array of bytes</li>
<li><code>key</code> - for an object, the key of the property this message was created from. The node can be configured to also copy this value to another message properties, such as <code>msg.topic</code>.</li>
<li><code>len</code> - the length of each message when split using a fixed length value</li>
</ul>
</dd>
</dl>
<h3>Details</h3>
<p>This node makes it easy to create a flow that performs common actions across
a sequence of messages before, using the <b>join</b> node, recombining the
sequence into a single message.</p>
<p>It uses the <code>msg.parts</code> property to track the individual parts
of a sequence.</p>
<h4>Streaming mode</h4>
<p>The node can also be used to reflow a stream of messages. For example, a
serial device that sends newline-terminated commands may deliver a single message
with a partial command at its end. In 'streaming mode', this node will split
a message and send each complete segment. If there is a partial segment at the end,
the node will hold on to it and prepend it to the next message that is received.
</p>
<p>When operating in this mode, the node will not set the <code>msg.parts.count</code>
property as it does not know how many messages to expect in the stream. This
means it cannot be used with the <b>join</b> node in its automatic mode</p>
</script>
<script type="text/x-red" data-help-name="join">
<p>Joins sequences of messages into a single message.</p>
<p>There are three modes available:</p>
<dl>
<dt>automatic</dt>
<dd>When paired with the <b>split</b> node, it will automatically join the messages to reverse the split that was performed.</dd>
<dt>manual</dt>
<dd>Join sequences of messages in a variety of ways.</dd>
<dt>reduce sequence</dt>
<dd>Apply an expression against all messages in a sequence to reduce it to a single message.</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">parts<span class="property-type">object</span></dt>
<dd>To automatically join a sequence of messages, they should all have
this property set. The <b>split</b> node generates this property but it
can be manually created. It has the following properties:
<ul>
<li><code>id</code> - an identifier for the group of messages</li>
<li><code>index</code> - the position within the group</li>
<li><code>count</code> - the total number of messages in the group</li>
<li><code>type</code> - the type of message - string/array/object/buffer</li>
<li><code>ch</code> - for a string or buffer, the data used to the split the message as either the string or an array of bytes</li>
<li><code>key</code> - for an object, the key of the property this message was created from</li>
<li><code>len</code> - the length of each message when split using a fixed length value</li>
</ul>
</dd>
<dt class="optional">complete</dt>
<dd>If set, the node will send its output message in its current state.</dd>
</dl>
<h3>Details</h3>
<h4>Automatic mode</h4>
<p>Automatic mode uses the <code>parts</code> property of incoming messages to
determine how the sequence should be joined. This allows it to automatically
reverse the action of a <b>split</b> node.
<h4>Manual mode</h4>
<p>When configured to join in manual mode, the node is able to join sequences
of messages into a number of different results:</p>
<ul>
<li>a <b>string</b> or <b>buffer</b> - created by joining the selected property of each message with the specified join characters or buffer.</li>
<li>an <b>array</b> - created by adding each selected property, or entire message, to the output array.</li>
<li>a <b>key/value object</b> - created by using a property of each message to determine the key under which
the required value is stored.</li>
<li>a <b>merged object</b> - created by merging the property of each message under a single object.</li>
</ul>
<p>The other properties of the output message are taken from the last message received before the result is sent.</p>
<p>A <i>count</i> can be set for how many messages should be received before generating the output message.
For object outputs, once this count has been reached, the node can be configured to send a message for each subsequent message
received.</p>
<p>A <i>timeout</i> can be set to trigger sending the new message using whatever has been received so far.</p>
<p>If a message is received with the <b>msg.complete</b> property set, the output message is finalised and sent.
This resets any part counts.</p>
<p>If a message is received with the <b>msg.reset</b> property set, the partly complete message is deleted and not sent.
This resets any part counts.</p>
<h4>Reduce Sequence mode</h4>
<p>When configured to join in reduce mode, an expression is applied to each
message in a sequence and the result accumulated to produce a single message.</p>
<dl class="message-properties">
<dt>Initial value</dt>
<dd>The initial value of the accumulated value (<code>$A</code>).</dd>
<dt>Reduce expression</dt>
<dd>A JSONata expression that is called for each message in the sequence.
The result is passed to the next call of the expression as the accumulated value.
In the expression, the following special variables can be used:
<ul>
<li><code>$A</code>: the accumulated value, </li>
<li><code>$I</code>: index of the message in the sequence, </li>
<li><code>$N</code>: number of messages in the sequence.</li>
</ul>
</dd>
<dt>Fix-up expression</dt>
<dd>An optional JSONata expression that is applied after the reduce expression
has been applied to all messages in the sequence.
In the expression, following special variables can be used:
<ul>
<li><code>$A</code>: the accumulated value, </li>
<li><code>$N</code>: number of messages in the sequence.</li>
</ul>
</dd>
<p>By default, the reduce expression is applied in order, from the first
to the last message of the sequence. It can optionally be applied in
reverse order.</p>
</dl>
<p><b>Example:</b> the following settings, given a sequence of numeric values,
calculates the average value:
<ul>
<li><b>Reduce expression</b>: <code>$A+payload</code></li>
<li><b>Initial value</b>: <code>0</code></li>
<li><b>Fix-up expression</b>: <code>$A/$N</code></li>
</ul>
</p>
<h4>Storing messages</h4>
<p>This node will buffer messages internally in order to work across sequences. The
runtime setting <code>nodeMessageBufferMaxLength</code> can be used to limit how many messages nodes
will buffer.</p>
</script>

View File

@ -0,0 +1,41 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="sort">
<p>A function that sorts message property or a sequence of messages.</p>
<p>When configured to sort message property, the node sorts array data pointed to by specified message property.</p>
<p>When configured to sort a sequence of messages, it will reorder the messages.</p>
<p>The sorting order can be:</p>
<ul>
<li><b>ascending</b>,</li>
<li><b>descending</b>.</li>
</ul>
<p>For numbers, numerical ordering can be specified by a checkbox.</p>
<p>Sort key can be element value or JSONata expression for sorting property value, or message property or JSONata expression for sorting a message sequence.<p>
<p>When sorting a message sequence, the sort node relies on the received messages to have <code>msg.parts</code> set. The split node generates this property, but can be manually created. It has the following properties:</p>
<p>
<ul>
<li><code>id</code> - an identifier for the group of messages</li>
<li><code>index</code> - the position within the group</li>
<li><code>count</code> - the total number of messages in the group</li>
</ul>
</p>
<p><b>Note:</b> This node internally keeps messages for its operation. In order to prevent unexpected memory usage, maximum number of messages kept can be specified. Default is no limit on number of messages.
<ul>
<li><code>nodeMessageBufferMaxLength</code> property set in <b>settings.js</b>.</li>
</ul>
</p>
</script>

View File

@ -0,0 +1,42 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="batch">
<p>Creates sequences of messages based on various rules.</p>
<h3>Details</h3>
<p>There are three modes for creating message sequences:</p>
<dl>
<dt>Number of messages</dt>
<dd>groups messages into sequences of a given length. The <b>overlap</b>
option specifies how many messages at the end of one sequence should be
repeated at the start of the next sequence.</dd>
<dt>Time interval</dt>
<dd>groups messages that arrive within the specified interval. If no messages
arrive within the interval, the node can optionally send on an empty message.</dd>
<dt>Concatenate Sequences</dt>
<dd>creates a message sequence by concatenating incoming sequences. Each message
must have a <code>msg.topic</code> property and a <code>msg.parts</code> property
identifying its sequence. The node is configured with a list of <code>topic</code>
values to identify the order sequences are concatenated.
</dd>
</dl>
<h4>Storing messages</h4>
<p>This node will buffer messages internally in order to work across sequences. The
runtime setting <code>nodeMessageBufferMaxLength</code> can be used to limit how many messages nodes
will buffer.</p>
</script>

View File

@ -0,0 +1,45 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="csv">
<p>Converts between a CSV formatted string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | array | string</span></dt>
<dd>A JavaScript object, array or CSV string.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | array | string</span></dt>
<dd>
<ul>
<li>If the input is a string it tries to parse it as CSV and creates a JavaScript object of key/value pairs for each line.
The node will then either send a message for each line, or a single message containing an array of objects.</li>
<li>If the input is a JavaScript object it tries to build a CSV string.</li>
<li>If the input is an array of simple values, it builds a single line CSV string.</li>
<li>If the input is an array of arrays, or an array of objects, a multiple-line CSV string is created.</li>
</ul>
</dd>
</dl>
<h3>Details</h3>
<p>The column template can contain an ordered list of column names. When converting CSV to an object, the column names
will be used as the property names. Alternatively, the column names can be taken from the first row of the CSV.</p>
<p>When converting to CSV, the column template is used to identify which properties to extract from the object and in what order.</p>
<p>If the input is an array then the columns template is only used to optionally generate a row of column titles.</p>
<p>The node can accept a multi-part input as long as the <code>parts</code> property is set correctly.</p>
<p>If outputting multiple messages they will have their <code>parts</code> property set and form a complete message sequence.</p>
<p><b>Note:</b> the column template must be comma separated - even if a different separator is chosen for the data.</p>
</script>

View File

@ -0,0 +1,36 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="html">
<p>Extracts elements from an html document held in <code>msg.payload</code> using a CSS selector.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the html string from which to extract elements.</dd>
<dt class="optional">select <span class="property-type">string</span></dt>
<dd>if not configured in the edit panel the selector can be set as a property of msg.</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">array | string</span></dt>
<dd>the result can be either a single message with a payload containing an array of the matched elements, or multiple
messages that each contain a matched element. If multiple messages are sent they will also have <code>parts</code> set.</dd>
</dl>
<h3>Details</h3>
<p>This node supports a combination of CSS and jQuery selectors. See the
<a href="https://github.com/fb55/CSSselect#user-content-supported-selectors" target="_blank">css-select documentation</a> for more information
on the supported syntax.</p>
</script>

View File

@ -0,0 +1,52 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="json">
<p>Converts between a JSON string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>A JavaScript object or JSON string.</dd>
<dt>schema<span class="property-type">object</span></dt>
<dd>An optional JSON Schema object to validate the payload against.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>
<ul>
<li>If the input is a JSON string it tries to parse it to a JavaScript object.</li>
<li>If the input is a JavaScript object it creates a JSON string. The string can optionally be well-formatted.</li>
</ul>
</dd>
<dt>schemaError<span class="property-type">array</span></dt>
<dd>If JSON schema validation fails, the catch node will have a <code>schemaError</code> property
containing an array of errors.</dd>
</dl>
<h3>Details</h3>
<p>By default, the node operates on <code>msg.payload</code>, but can be configured
to convert any message property.</p>
<p>The node can also be configured to ensure a particular encoding instead of toggling
between the two. This can be used, for example, with the <code>HTTP In</code>
node to ensure the payload is a parsed object even if an incoming request
did not set its content-type correctly for the HTTP In node to do the conversion.</p>
<p>If the node is configured to ensure the property is encoded as a String and it
receives a String, no further checks will be made of the property. It will
not check the String is valid JSON nor will it reformat it if the format option
is selected.</p>
<p>For more details about JSON Schema you can consult the specification
<a href="http://json-schema.org/latest/json-schema-validation.html">here</a>.</p>
</script>

View File

@ -0,0 +1,51 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="xml">
<p>Converts between an XML string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>A JavaScript object or XML string.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>
<ul>
<li>If the input is a string it tries to parse it as XML and creates a JavaScript object.</li>
<li>If the input is a JavaScript object it tries to build an XML string.</li>
</ul>
</dd>
<dt class="optional">options <span class="property-type">object</span></dt>
<dd>This optional property can be used to pass in any of the options supported by the underlying
library used to convert to and from XML. See <a href="https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options" target="_blank">the xml2js docs</a>
for more information.</dd>
</dl>
<h3>Details</h3>
<p>When converting between XML and an object, any XML attributes are added as a property named <code>$</code> by default.
Any text content is added as a property named <code>_</code>. These property names can be specified in the node configuration.</p>
<p>For example, the following XML will be converted as shown:</p>
<pre>&lt;p class="tag"&gt;Hello World&lt;/p&gt;</pre>
<pre>{
"p": {
"$": {
"class": "tag"
},
"_": "Hello World"
}
}</pre>
</script>

View File

@ -0,0 +1,34 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="yaml">
<p>Converts between a YAML formatted string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>A JavaScript object or YAML string.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | string</span></dt>
<dd>
<ul>
<li>If the input is a YAML string it tries to parse it to a JavaScript object.</li>
<li>If the input is a JavaScript object it creates a YAML string.</li>
</ul>
</dd>
</dl>
</script>

View File

@ -0,0 +1,25 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="tail">
<p>Tails (watches for things to be added) to the configured file. (Linux/Mac ONLY)</p>
<p>This will not work on Windows filesystems, as it relies on the <b>tail -F</b> command.</p>
<h3>Outputs</h3>
<ul>
<li>Text (UTF-8) files will be returned as strings.</li>
<li>Binary files will be returned as Buffer objects.</li>
</ul>
</script>

View File

@ -0,0 +1,73 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="file">
<p>Writes <code>msg.payload</code> to a file, either adding to the end or replacing the existing content.
Alternatively, it can delete the file.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">filename <span class="property-type">string</span></dt>
<dd>If not configured in the node, this optional property sets the name of the file to be updated.</dd>
</dl>
<h3>Output</h3>
<p>On completion of write, input message is sent to output port.</p>
<h3>Details</h3>
<p>Each message payload will be added to the end of the file, optionally appending
a newline (\n) character between each one.</p>
<p>If <code>msg.filename</code> is used the file will be closed after every write.
For best performance use a fixed filename.</p>
<p>It can be configured to overwrite the entire file rather than append. For example,
when writing binary data to a file, such as an image, this option should be used
and the option to append a newline should be disabled.</p>
<p>Alternatively, this node can be configured to delete the file.</p>
</script>
<script type="text/x-red" data-help-name="file in">
<p>Reads the contents of a file as either a string or binary buffer.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">filename <span class="property-type">string</span></dt>
<dd>if not set in the node configuration, this property sets the filename to read.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd>The contents of the file as either a string or binary buffer.</dd>
<dt class="optional">filename <span class="property-type">string</span></dt>
<dd>If not configured in the node, this optional property sets the name of the file to be read.</dd>
<dt class="optional">error <span class="property-type">object</span></dt>
<dd><i>deprecated</i>: If enabled in the node, when the node hits an error
reading the file, it will send a message with no <code>payload</code>
and this <code>error</code> property set to the error details. This
mode of behaviour is deprecated and not enabled by default for new
instances of the node. See below for more information.</dd>
</dl>
<h3>Details</h3>
<p>The filename should be an absolute path, otherwise it will be relative to
the working directory of the Node-RED process.</p>
<p>On Windows, path separators may need to be escaped, for example: <code>\\Users\\myUser</code>.</p>
<p>Optionally, a text file can be split into lines, outputting one message per line, or a binary file
split into smaller buffer chunks - the chunk size being operating system dependant, but typically 64k (Linux/Mac) or 41k (Windows).</p>
<p>When split into multiple messages, each message will have a <code>parts</code>
property set, forming a complete message sequence.</p>
<h4>Legacy error handling</h4>
<p>Before Node-RED 0.17, if this node hit an error whilst reading the file, it would
send a message with no <code>msg.payload</code> and <code>msg.error</code> set to the
details of the error. This is a deprecated mode of behaviour for the node that new
instances will not do. If required, this mode can be re-enabled within the node
configuration.</p>
<p>Errors should be caught and handled using a Catch node.</p>
</script>