[CCSDK-28] populated the seed code for dgbuilder
[ccsdk/distribution.git] / dgbuilder / core_nodes / storage / 50-file.html
1 <!--
2   Copyright 2013, 2014 IBM Corp.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 -->
16
17 <script type="text/x-red" data-template-name="file">
18     <div class="form-row node-input-filename">
19          <label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
20          <input type="text" id="node-input-filename" placeholder="Filename">
21     </div>
22     <div class="form-row">
23         <label>&nbsp;</label>
24         <input type="checkbox" id="node-input-appendNewline" placeholder="Name" style="display: inline-block; width: auto; vertical-align: top;">
25         <label for="node-input-appendNewline" style="width: 70%;">Append newline ?</label>
26     </div>
27     <div class="form-row">
28         <label>&nbsp;</label>
29         <input type="checkbox" id="node-input-overwriteFile" placeholder="Name" style="display: inline-block; width: auto; vertical-align: top;">
30         <label for="node-input-overwriteFile" style="width: 70%;">Overwrite complete file ?</label>
31     </div>
32     <div class="form-row">
33         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
34         <input type="text" id="node-input-name" placeholder="Name">
35     </div>
36 </script>
37
38 <script type="text/x-red" data-help-name="file">
39     <p>Writes <b>msg.payload</b> to the file specified, e.g. to create a log.</p>
40     <p>The filename can be overridden by the <b>msg.filename</b> property of the incoming message.</p>
41     <p>A newline is added to every message. But this can be turned off if required, for example, to allow binary files to be written.</p>
42     <p>The default behaviour is to append to the file. This can be changed to overwrite the file each time, for example if you want to output a "static" web page or report.</p>
43     <p>If a <b>msg.delete</b> property exists then the file will be deleted instead.</p>
44 </script>
45
46 <script type="text/x-red" data-template-name="file in">
47     <div class="form-row">
48          <label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
49          <input type="text" id="node-input-filename" placeholder="Filename">
50     </div>
51     <div class="form-row">
52         <label for="node-input-format"><i class="fa fa-sign-out"></i> Output as</label>
53         <select id="node-input-format">
54             <option value="utf8">a utf8 string</option>
55             <option value="">a Buffer</option>
56         </select>
57     </div>
58     <div class="form-row">
59         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
60         <input type="text" id="node-input-name" placeholder="Name">
61     </div>
62 </script>
63
64 <script type="text/x-red" data-help-name="file in">
65     <p>Reads the specified file and sends the content as <b>msg.payload</b>, and the filename as <b>msg.filename</b>.</p>
66     <p>The filename can be overridden by the <b>msg.filename</b> property of the incoming message.</p>
67 </script>
68
69 <script type="text/javascript">
70     RED.nodes.registerType('file',{
71         category: 'storage-output',
72         defaults: {
73             name: {value:""},
74             filename: {value:""},
75             appendNewline: {value:true},
76             overwriteFile: {value:false}
77         },
78         color:"BurlyWood",
79         inputs:1,
80         outputs:0,
81         icon: "file.png",
82         align: "right",
83         label: function() {
84             return this.name||this.filename;
85         },
86         labelStyle: function() {
87             return this.name?"node_label_italic":"";
88         }
89     });
90
91     RED.nodes.registerType('file in',{
92         category: 'storage-input',
93         defaults: {
94             name: {value:""},
95             filename: {value:""},
96             format: {value:"utf8"},
97         },
98         color:"BurlyWood",
99         inputs:1,
100         outputs:1,
101         icon: "file.png",
102         label: function() {
103             return this.name||this.filename;
104         },
105         labelStyle: function() {
106             return this.name?"node_label_italic":"";
107         }
108     });
109
110 </script>