check for value type and convert anything that isn't a buffer or string

pull/4880/head
Gerrit Riessen 2025-02-24 22:15:19 +01:00
parent 516faf25a0
commit ad230c99b7
1 changed files with 6 additions and 0 deletions

View File

@ -150,6 +150,9 @@ module.exports = function(RED) {
var value = RED.util.getMessageProperty(msg, node.addpay);
if (value !== undefined) {
var stdinStream = new stream.Readable();
if (!Buffer.isBuffer(value) && (typeof value) !== 'string') {
value = JSON.stringify(value)
}
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
stdinStream.push(null); // Signals the end of the stream (EOF)
stdinStream.pipe(child.stdin);
@ -204,6 +207,9 @@ module.exports = function(RED) {
var value = RED.util.getMessageProperty(msg, node.addpay);
if (value !== undefined) {
var stdinStream = new stream.Readable();
if (!Buffer.isBuffer(value) && (typeof value) !== 'string') {
value = JSON.stringify(value)
}
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
stdinStream.push(null); // Signals the end of the stream (EOF)
stdinStream.pipe(child.stdin);