Use correct Buffer.from method rather than constructor

exec, tcp, ump and file nodes
This commit is contained in:
Dave Conway-Jones
2017-06-27 17:11:36 +01:00
parent 4dd2d3ac7d
commit d99432bff1
4 changed files with 22 additions and 22 deletions

View File

@@ -91,7 +91,7 @@ module.exports = function(RED) {
child.stderr.on('data', function (data) {
if (node.activeProcesses.hasOwnProperty(child.pid) && node.activeProcesses[child.pid] !== null) {
if (isUtf8(data)) { msg.payload = data.toString(); }
else { msg.payload = new Buffer.from(data); }
else { msg.payload = Buffer.from(data); }
node.send([null,RED.util.cloneMessage(msg),null]);
}
});
@@ -126,7 +126,7 @@ module.exports = function(RED) {
/* istanbul ignore else */
if (RED.settings.verbose) { node.log(cl); }
child = exec(cl, {encoding: 'binary', maxBuffer:10000000}, function (error, stdout, stderr) {
msg.payload = new Buffer.from(stdout,"binary");
msg.payload = Buffer.from(stdout,"binary");
if (isUtf8(msg.payload)) { msg.payload = msg.payload.toString(); }
var msg2 = null;
if (stderr) {