1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

tidied up implementation of file node close fix

This commit is contained in:
Dave Conway-Jones 2017-06-28 17:50:09 +01:00
parent 160c27c15a
commit dded98e30c
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D

View File

@ -63,7 +63,7 @@ module.exports = function(RED) {
node.wstream.on("error", function(err) { node.wstream.on("error", function(err) {
node.error(RED._("file.errors.writefail",{error:err.toString()}),msg); node.error(RED._("file.errors.writefail",{error:err.toString()}),msg);
}); });
node.wstream.write(node.data.shift(), function() { node.wstream.end(); }); node.wstream.end(node.data.shift());
} }
else { else {
if ((!node.wstream) || (!node.filename)) { if ((!node.wstream) || (!node.filename)) {
@ -73,7 +73,7 @@ module.exports = function(RED) {
}); });
} }
if (node.filename) { node.wstream.write(node.data.shift()); } if (node.filename) { node.wstream.write(node.data.shift()); }
else { node.wstream.write(node.data.shift(), function() { node.wstream.end(); }); } else { node.wstream.end(node.data.shift()); }
} }
} }
} }