0.3.0 • Published 3 years ago

protoflex v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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

0.3.0

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago