Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antpb

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antpb

Protocol Buffers for JavaScript. It from the dcodeIO protobufjs, we modify some files to achieve our need.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

antpb

Protocol Buffers for JavaScript. It from the dcodeIO protobufjs, we modify some files to achieve our need.

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ tnpm install antpb --save

Usage

  • load all *.proto files in specified directory
const protobuf = require('antpb');

const root = protobuf.loadAll('/proto_file_path');

const ProtoObj = root.lookup('com.alipay.test.service.ProtoObj');
const map = new Map();
map.set(false, {
  name: 'Peter',
  finalField: '123',
});

const req = ProtoObj.create({
  testObj2: {
    name: 'zongyu',
    finalField: '321',
  },
  map3: map,
});

const buf = ProtoObj.encode(req).finish();
const ret = ProtoObj.decode(buf); // => { testObj2: { name: 'zongyu', finalField: '321' }, map3: <Map> }
  • load interface schame from JSON file
const protobuf = require('@alipay/protobufjs');

const root = protobuf.fromJSON(/proto_json_file_path);

...

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

Other API

refer: https://github.com/dcodeIO/protobuf.js

Keywords

FAQs

Package last updated on 16 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc