prisme-flow
Version:
prisme platform flow engine
53 lines (45 loc) • 1.58 kB
HTML
<!--
Created by prisme.io on 09/06/2017.
@author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io)
-->
<script type="text/x-red" data-template-name="binary">
<div class="form-row">
<label for="node-input-pattern"><i class="fa fa-exchange"></i> Pattern</label>
<input type="text" id="node-input-pattern">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="binary">
<p>A parser that takes the <code>msg.payload</code> and converts it to/from binary data.
<b>Pattern</b> specifies the binary format.</p>
<p>If the input is a buffer it tries to parse it and creates a javascript object.</p>
<p>If the input is a javascript object it tries to serialize it and creates a buffer.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType("binary", {
category: "utility",
color: "#DEBD5C",
defaults: {
name: {
value: ""
},
pattern: {
value: "",
required: true,
validate:RED.validators.regex(/^(-?)([xbl])(\d+)([fa]?)(.*)$/)
}
},
inputs: 1,
outputs: 1,
icon: "binary.png",
label: function() {
return this.name || "binary";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
}
});
</script>