mirror of
https://github.com/node-red/node-red
synced 2024-11-23 08:59:13 +00: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:
commit
dd9fc6a250
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user