-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnode-red-watchdirectory.html
117 lines (108 loc) · 4.99 KB
/
node-red-watchdirectory.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<script type="text/javascript">
RED.nodes.registerType('watch-directory',{
category: 'storage',
color: 'burlywood',
defaults: {
folder: {value:"", required: true},
folderType:{value:"str"},
recursive: {value:0},
typeEvent: {value:"create"},
ignoreInitial: {value:true},
ignoredFiles: {value:"",validate: RED.validators.typedInput("ignoredFilesType")},
ignoredFilesType: { value:"re" },
name: {value:""}
},
inputs:0,
outputs:1,
icon: "font-awesome/fa-eye",
label: function() {
return this.name|| this.folder || "watch-directory";
},
oneditprepare: function() {
$("#node-input-folder").typedInput({
default: 'str',
types: ['flow','global','str','jsonata','env'],
typeField: $("#node-input-folderType")
});
$("#node-input-ignoredFiles").typedInput({
default: this.ignoredFilesType || 're',
types:['re'],
typeField: $("#node-input-ignoredFilesType")})
},
onsave: function(){
this.ignoredFilesType = $("#node-input-ignoredFilesType").val()
}
});
</script>
<script type="text/html" data-template-name="watch-directory">
<div class="form-row">
<label for="node-input-folder"><i class="fa fa-folder-open"></i> Folder</label>
<input type="text" id="node-input-folder" placeholder="Path to watching folder">
<input type="hidden" id="node-input-folderType">
</div>
<div class="form-row">
<label for="node-input-typeEvent"><i class="fa fa-rss"></i> Type events</label>
<select id="node-input-typeEvent">
<option value="create">Create</option>
<option value="update">Update</option>
<option value="delete">Delete</option>
</select>
</div>
<div class="form-row">
<label for="node-input-ignoredFiles"><i class="fa fa-file-excel-o"></i> Ignore files</label>
<input type="text" id="node-input-ignoredFiles" placeholder="Regex for exclude files">
<input type="hidden" id="node-input-ignoredFilesType">
</div>
<div class="form-row">
<label for="node-input-recursive"><i class="fa fa-sitemap"></i> Depth</label>
<input type="number" id="node-input-recursive" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label for="node-input-ignoreInitial"> </label>
<input type="checkbox" id="node-input-ignoreInitial" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-ignoreInitial" style="width: auto"><i class="fa fa-reply-all" style="transform: scaleX(-1);"></i> On start ignore files in folder</label>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="watch-directory">
<p>A simple node that watch directory for detect add, change and delete file / folder.
Wrapper for <a href='https://github.com/paulmillr/chokidar' target="_blank">chokidar</a></p>
<h3>Properties</h3>
<dl class="message-properties">
<dt>folder<span class="property-type">string</span></dt>
<dd>Path of directory to watch</dd>
<dt>type event<span class="property-type">select</span></dt>
<dd>Type of event who fire the flow</dd>
<dt>ignored files<span class="property-type">regex</span></dt>
<dd>(Optional) regex that match file name to exclude (check only on name.ext, not on all path)</dd>
<dt>recursive<span class="property-type">number</span></dt>
<dd>Depth of folders to watch</dd>
<dt>On start ignore files in folder<span class="property-type">boolean</span></dt>
<dd>If they are file in watching directory at start, ignore them</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>file
<span class="property-type">string</span>
</dt>
<dd>the name of the file, with extension</dd>
<dt>filedir
<span class="property-type">string</span>
</dt>
<dd>the directory of the file</dd>
<dt>filename
<span class="property-type">string</span>
</dt>
<dd>the complete path to the file (filedir + file)</dd>
<dt>payload
<span class="property-type">string</span>
</dt>
<dd>like filename : the complete path to the file (filedir + file)</dd>
</dl>
<h3>Details</h3>
<p>This plugin it's a wrapper for chokidar. I thing that everything it's clear, if it not :
<a href="https://github.com/fatoldsun00/node-red-contrib-watchdirectory/issues" target="_blank">Try to open an issue on my github</a></p>
</script>