diff --git a/nodes/core/locales/en-US/messages.json b/nodes/core/locales/en-US/messages.json
index 5e4263ae3..b911f1985 100644
--- a/nodes/core/locales/en-US/messages.json
+++ b/nodes/core/locales/en-US/messages.json
@@ -194,7 +194,7 @@
"h": "Hours"
},
"extend": " extend delay if new message arrives",
- "tip": "The node can also be reset by sending a message with the msg.reset property set to any value.",
+ "tip": "The node can also be reset by sending a message with the msg.reset
property set to any value.",
"label": {
"trigger": "trigger",
"trigger-block": "trigger & block",
@@ -405,7 +405,7 @@
},
"tip": {
"in": "Tip: Make sure your firewall will allow the data in.",
- "out": "Tip: leave address and port blank if you want to set using msg.ip and msg.port.",
+ "out": "Tip: leave address and port blank if you want to set using msg.ip
and msg.port
.",
"port": "Ports already in use: "
},
"status": {
@@ -637,8 +637,13 @@
"tail": {
"label": {
"filename": "Filename",
+ "type": "File type",
"splitlines": "Split lines on \\n?"
},
+ "action": {
+ "text": "Text - returns String",
+ "binary": "Binary - returns Buffer"
+ },
"errors": {
"windowsnotsupport": "Not currently supported on Windows."
}
diff --git a/nodes/core/storage/28-tail.html b/nodes/core/storage/28-tail.html
index 25f497f87..0aac80f9b 100644
--- a/nodes/core/storage/28-tail.html
+++ b/nodes/core/storage/28-tail.html
@@ -1,5 +1,5 @@
diff --git a/nodes/core/storage/28-tail.js b/nodes/core/storage/28-tail.js
index c3d3cf37e..824824885 100644
--- a/nodes/core/storage/28-tail.js
+++ b/nodes/core/storage/28-tail.js
@@ -1,5 +1,5 @@
/**
- * Copyright 2013, 2014 IBM Corp.
+ * Copyright 2013,2016 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.filename = n.filename;
+ this.filetype = n.filetype || "text";
this.split = n.split;
var node = this;
@@ -34,24 +35,28 @@ module.exports = function(RED) {
// TODO: rewrite to use node-tail
var tail = spawn("tail", ["-F", "-n", "0", this.filename]);
tail.stdout.on("data", function (data) {
- if (node.split) {
- // TODO: allow customisation of the line break - as we do elsewhere
- var strings = data.toString().split("\n");
- for (var s in strings) {
- //TODO: should we really filter blanks? Is that expected?
- if (strings[s] !== "") {
- node.send({
- topic: node.filename,
- payload: strings[s]
- });
+ var msg = { topic:node.filename };
+ if (this.filetype === "text") {
+ if (node.split) {
+ // TODO: allow customisation of the line break - as we do elsewhere
+ var strings = data.toString().split("\n");
+ for (var s in strings) {
+ //TODO: should we really filter blanks? Is that expected?
+ if (strings[s] !== "") {
+ node.send({
+ topic: node.filename,
+ payload: strings[s]
+ });
+ }
}
}
+ else {
+ msg.payload = data.toString();
+ node.send(msg);
+ }
}
else {
- var msg = {
- topic:node.filename,
- payload: data.toString()
- };
+ msg.payload = data;
node.send(msg);
}
});