antpb
Protocol Buffers for JavaScript. It from the dcodeIO protobufjs, we modify some files to achieve our need.
Install
$ tnpm install antpb --save
Usage
- load all *.proto files in specified directory
const protobuf = ; const root = protobuf; const ProtoObj = root;const map = ;map; const req = ProtoObj; const buf = ProtoObj;const ret = ProtoObj; // => { testObj2: { name: 'zongyu', finalField: '321' }, map3: <Map> }
- load interface schame from JSON file
const protobuf = ; const root = protobuf; ...
API
Top API
loadAll(protoPath, [options])
load all *.proto files in specified directory- {String} protoPath - the proto folder
- {Object} [options] - optional arguments
fromJSON(jsonFile, [root])
load interface schame from JSON file- {String} jsonFile - JSON file path
- {Root} [root] - root node, if it is not provided, will create the new one