I am using a library which on call of a function returns the toString of a buffer.
The exact code is
var bufStr = Buffer.concat(stdOut).toString('utf-8');
//convert bufStr back to only Buffer.concat(stdOut).
var buf = Buffer.from(bufStr, 'utf-8');
var buf = Buffer.from(bufStr);
You can do:
var buf = Buffer.from(bufStr, 'utf8');
But this is a bit silly, so another suggestion would be to copy the minimal amount of code out of the called function to allow yourself access to the original buffer. This might be quite easy or fairly difficult depending on the details of that library.