6

It seems that there are a few modules available for Node.js from multiple people to work with protocol buffers. Some are more or less actively maintained. I found https://github.com/chrisdew/protobuf which seems to be working fine. But is there a tried and true (officially certified) path?

4 Answers 4

11

No doubt... the better,complete and beautifully designed is: Protobuf.js

Cheers!

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

1 Comment

chrisdew's implementarion might not be the best option if you are using windows, in that case you have to make sure all the C++ library are installed. Otherwise you might run into issues like this github.com/chrisdew/protobuf/issues/22. So I suggest it is better to go with Protobuf.js.
2

There are no official implementations of Protobuf aside from Java, Python and C++. For node.js, you'll probably want to go with chrisdew since it's the one on npm. I personally use my own fork because I need to work with int64's.

5 Comments

Can you elaborate on why you forked Chris Dew's implementation? What is your use case? Thank you.
@shargors: I'm developing a Node.js implementation of Steam. Steam uses protobuf extensively and passes around int64's a lot. chrisdew's module converts int64's into Numbers, losing precision, which is unacceptable for me.
Do you mean that when proto buf int64 is converted into JavaScript Number then precision is lost? How could that be?
And if this is an issue why not to check in a fix into chris dew's code base on github?
@shargors: JavaScript Numbers are 64-bit floats - enough to store 32-bit ints, but not 64-bit ints. Try typing "76561197976267165" (without quotes) in a JS console and see what you get. I already added a pull request to chrisdew's repo but he doesn't seem to like it and I don't really care.
2

It's worth mention protocol-buffers nodejs package as an option

Comments

2

Now you already have a JS google official version. You can download it here https://github.com/google/protobuf/releases

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.