TCP server is sending data into my Nodejs server. So I want to get buffer object data into array format in Nodejs.
Buffer data format:
data = <Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 ...>
I wanted to parse it into human-readable format. So I use data.toString()
then it will return data in a human-readable JSON format as a string.
JSON.parse()
function used to parse the string to JSON but it's showing JSON parsing error while converting String to JSON.
Can you provide me the correct code to fetch TCP data into array format in Nodejs?