5

I am getting data from TCP into node.js. The data is in buffer format and looks like:

♣ ? d       ?&+? 

How can I parse that data into normal strings, eg 12345

Thank you.

2 Answers 2

7

Node buffers have a toString method, here's the documentation on it http://nodejs.org/docs/v0.4.2/api/buffers.html#buffer.toString

Sign up to request clarification or add additional context in comments.

1 Comment

The buffer is is an Open Sound Control format. Tying to decode with mybuffer.toString("utf8", start=44, 60) gives me >?V?◄►7?N?ND
0

You could use a library like this:

https://github.com/rmustacc/node-ctype

which provides accessors for reading and writing binary buffers.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.