i am trying to parse a buffer from server (unknown data) so i can read it and create a JSON file with it. When i try to parse the buffer, this error message appear: TypeError: bufferStr.replace is not a function.
Can someone tell me why this happens? I am using the code that i have found here, but with no success
function bufferFromBufferString(bufferStr) {
return Buffer.from(
bufferStr
.replace(/[<>]/, '')
.split(' ')
.slice(1)
.reduce((acc, val) =>
acc.concat(parseInt(val, 16)), [])
)
}