Google Protocol Buffers - JavaScript [英] Google Protocol Buffers - JavaScript

查看:132
本文介绍了Google Protocol Buffers - JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JavaScript中使用Google协议缓冲区是一个不错的选择还是使用JSON更好?

Is it a good choice to use Google Protocol Buffers in JavaScript or is it better to do it with JSON?

此外,如果有人可以给我一个简单的例子JavaScript中的协议缓冲区实现。因为谷歌的网站我觉得它很差。

Also if someone can give me a simple example about Protocol Buffers implementation in JavaScript. Becauseon Google's site I think it's very poor.

推荐答案

Google的开源协议缓冲区实现可在 github

[edit] Google's open source implementation of protocol buffers is available on github

官方protobuf项目仅支持Java,C ++和Python。不是Javascript。

The official protobuf project support only Java, C++, and Python. Not Javascript.

根据项目的Wiki,有三个项目将协议缓冲区移植到Javascript。

According to the Wiki of the project, there are three projects porting protocol buffers to Javascript.

  • Protobuf.js: https://github.com/dcodeIO/ProtoBuf.js
  • protobuf-js: http://code.google.com/p/protobuf-js/
  • protojs: http://github.com/sirikata/protojs

Protobuf.js是 - 至今。
protobuf-js两年没有更新,所以我赞成Protobuf.js。

Protobuf.js is up-to-date. protobuf-js has not been updated for two years, so I would favor Protobuf.js.

问题仍然是为什么?:protobuf可能是稍微小一些,特别是在传输大量数值时,JSON只是JS空间中更常见的协议,可能更好地支持并更容易集成到其他工具中。

The question still is "Why"?: protobuf may be a bit smaller, especially when a lot of numeric values are transferred, but JSON is simply the more common protocol in the JS space and probably better supported and easier to integrate into other tools.

这篇关于Google Protocol Buffers - JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆