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

Merge pull request #437 from hindessm/file-query-node-usability

Minor fixes to messages sent from "file in" nodes.
This commit is contained in:
Dave Conway-Jones 2014-10-14 17:54:47 +01:00
commit dd9fc6a250

View File

@ -76,13 +76,15 @@ module.exports = function(RED) {
if (filename === "") { if (filename === "") {
node.warn('No filename specified'); node.warn('No filename specified');
} else { } else {
msg.filename = filename;
fs.readFile(filename,options,function(err,data) { fs.readFile(filename,options,function(err,data) {
if (err) { if (err) {
node.warn(err); node.warn(err);
msg.error = err; msg.error = err;
delete msg.payload;
} else { } else {
msg.filename = filename;
msg.payload = data; msg.payload = data;
delete msg.error;
} }
node.send(msg); node.send(msg);
}); });