Binary to string

I'm trying to get the output of a shell command but I get binary data:

msg.payload : buffer[238]
buffer[238][raw](http://192.168.0.2:1880/#)
[0 … 9]
[10 … 19]
[20 … 29]
[30 … 39]
[40 … 49]
[50 … 59]
[60 … 69]
[70 … 79]
[80 … 89]
[90 … 99]
[100 … 109]
[110 … 119]
[120 … 129]
[130 … 139]
[140 … 149]
[150 … 159]
[160 … 169]
[170 … 179]
[180 … 189]
[190 … 199]
[200 … 209]
[210 … 219]
[220 … 229]
[230 … 237]

As opposed to this which is the actual output from the command:

[INFO] Registration Status:Registered
[INFO] Channel address:0x0Bc9751eaD170125485f3dD3A2970214aE2F7220
[INFO] Balance: 25.714893 MYST
[INFO] Earnings: 0.504658
[INFO] Earnings total: 3.228151

I assume I'm supposed to convert the binary into a string, but don't know how.

Try
msg.payload = msg.payload.toString(); return msg;
in a function node.

1 Like

just what I needed, thanks.

The exec node should try to return a string if possible. So there must be a non-ascii character in the return that caused it to return a binary buffer.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.