From b515df611d7db25ef91573b093d4b8ab89276e8b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 28 Jun 2017 13:28:01 +0100 Subject: [PATCH] fix file node to overwrite multiple files --- nodes/core/storage/50-file.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nodes/core/storage/50-file.js b/nodes/core/storage/50-file.js index d1ff3b419..324ac51ea 100644 --- a/nodes/core/storage/50-file.js +++ b/nodes/core/storage/50-file.js @@ -59,12 +59,10 @@ module.exports = function(RED) { while (node.data.length > 0) { if (this.overwriteFile === "true") { - if (!node.wstream) { - node.wstream = fs.createWriteStream(filename, { encoding:'binary', flags:'w' }); - node.wstream.on("error", function(err) { - node.error(RED._("file.errors.writefail",{error:err.toString()}),msg); - }); - } + node.wstream = fs.createWriteStream(filename, { encoding:'binary', flags:'w' }); + node.wstream.on("error", function(err) { + node.error(RED._("file.errors.writefail",{error:err.toString()}),msg); + }); } else { if (!node.wstream) {