protoflex
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Protoflex

downloads version .min.js file size

Protoflex is a modern JavaScript library for working with arbitrary Protobuf data.

Online REPL: here

Why?

There were 2 main reasons for creating Protoflex:

  • Debugging/reversing Protobuf HTTP(s) APIs
  • Using Protobuf in relatively small scripts

So, Protoflex does its best to fit them both.

WARNING: this library is not recommended for production apps

Quick start:

Reading (deserializing)

const PB = require('protoflex')
const data = require('protoflex/utils').fromHex('082a')
console.log(PB.parse(data).int32(1))  // 42

or via JSON API:

const PB = require('protoflex')
const data = require('protoflex/utils').fromHex('082a')
console.log(PB.parse(data).toJSON()) // { '1': '42' }

Writing (serializing)

const PB = require('protoflex')
let msg = PB
    .create()
    .int32(1, 42)
console.log(msg.serialize())  // [0x08, 0x2a]

or via JSON API:

const PB = require('protoflex')
let msg = PB.fromJson({
    1: 42
})
console.log(msg.serialize())  // [0x08, 0x2a]

API Documentation:

Full API reference can be found here: https://teidesu.github.io/protoflex/api

Readme

Keywords

none

Package Sidebar

Install

npm i protoflex

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

442 kB

Total Files

22

Last publish

Collaborators

  • teidesu