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 === "") {
node.warn('No filename specified');
} else {
msg.filename = filename;
fs.readFile(filename,options,function(err,data) {
if (err) {
node.warn(err);
msg.error = err;
delete msg.payload;
} else {
msg.filename = filename;
msg.payload = data;
delete msg.error;
}
node.send(msg);
});