You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

protobuf-decode

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protobuf-decode

extremely light-weight protobuf decode module, no larger than 5kB

0.0.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Protobuf-decode

Javascript version protobuf decoder. Aim: light-weight, file size no larger than 5kB. Just decode simple structs.

Usage

We don't use .proto file, instead, we use a JSON formatted message description, basically the same as protobuf.js json format.

To decode a protobuf, first you need to use build() method to build the message package, this step will automatically detect embedded message dependencies and handle them for furthur use.

Then, you can pick your message from the result of first step to actually decode a byte array. This process shoud be like:

import protobuf from './protobuf';
import msgPackage from './msg_struct';

// build the messages package
const builders = protobuf.build(msgPackage),
      builder = builders.HistoryData;

// decode using message builder
protobuf.decode(byteArr, builder)

history versions

  • 0.0.3 support base64 encoded strings as input
  • 0.0.2 support embedded elements docs
  • 0.0.1 first relest

Demo

It's written in es6 style code, so you need to npm install babel-node. To test, you can run:

babel-node --presets es2015 test.js

Keywords

protobuf

FAQs

Package last updated on 11 Aug 2016

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