diff --git a/nodes/core/storage/50-file.js b/nodes/core/storage/50-file.js index 19ffb01f8..d6eb13357 100644 --- a/nodes/core/storage/50-file.js +++ b/nodes/core/storage/50-file.js @@ -20,23 +20,19 @@ module.exports = function(RED) { function FileNode(n) { RED.nodes.createNode(this,n); - - this.filename = n.filename; + this.filename = n.filename || ""; this.appendNewline = n.appendNewline; this.overwriteFile = n.overwriteFile; var node = this; this.on("input",function(msg) { var filename = msg.filename || this.filename; - if (filename === "") { node.warn('No filename specified'); } else if (typeof msg.payload != "undefined") { var data = msg.payload; if (typeof data == "object") { data = JSON.stringify(data); } if (typeof data == "boolean") { data = data.toString(); } - if (this.appendNewline) { - data += "\n"; - } + if (this.appendNewline) { data += "\n"; } if (msg.hasOwnProperty('delete')) { fs.unlink(filename, function (err) { if (err) { node.warn('Failed to delete file : '+err); } @@ -65,7 +61,7 @@ module.exports = function(RED) { function FileInNode(n) { RED.nodes.createNode(this,n); - this.filename = n.filename; + this.filename = n.filename || ""; this.format = n.format; var node = this; var options = {}; @@ -74,7 +70,6 @@ module.exports = function(RED) { } this.on("input",function(msg) { var filename = msg.filename || this.filename; - if (filename === "") { node.warn('No filename specified'); } else {