Name: antpb
Owner: node_modules
Description: Protocol Buffers for JavaScript. It from the dcodeIO protobufjs, we modify some files to achieve our need.
Created: 2018-05-16 07:38:59.0
Updated: 2018-05-16 11:26:24.0
Pushed: 2018-05-16 11:26:33.0
Homepage: null
Size: 15
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Protocol Buffers for JavaScript. It from the dcodeIO protobufjs, we modify some files to achieve our need.
pm install antpb --save
t protobuf = require('antpb');
t root = protobuf.loadAll('/proto_file_path');
t ProtoObj = root.lookup('com.alipay.test.service.ProtoObj');
t map = new Map();
set(false, {
me: 'Peter',
nalField: '123',
t req = ProtoObj.create({
stObj2: {
name: 'zongyu',
finalField: '321',
p3: map,
t buf = ProtoObj.encode(req).finish();
t ret = ProtoObj.decode(buf); // => { testObj2: { name: 'zongyu', finalField: '321' }, map3: <Map> }
t protobuf = require('@alipay/protobufjs');
t root = protobuf.fromJSON(/proto_json_file_path);
loadAll(protoPath, [options])
load all *.proto files in specified directoryfromJSON(jsonFile, [root])
load interface schame from JSON file