Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Mpbf

M(odular)pbf is a fork of pbf, the low-level, fast, ultra-lightweight (3KB gzipped) JavaScript library for decoding and encoding protocol buffers. Mpbf generates code for use in ESM-based projects.

Examples

Using Compiled Code

Install mpbf and compile a JavaScript module from a .proto file:

$ npm install -g mpbf
$ mpbf example.proto > example.js

Then read and write objects using the module like this:

import{Pbf}from'mbpf';import{Example}from'./example.js';// readconstpbf=newPbf(buffer);constobj=Example.read(pbf);// writeconstpbf=newPbf();Example.write(obj,pbf);constbuffer=pbf.finish();

Install

npm install mpbf

Proto Schema to JavaScript

If installed globally, mpbf provides a binary that compiles proto files into JavaScript modules. Usage:

$ mpbf <proto_path> [--no-write] [--no-read]

The --no-write and --no-read switches remove corresponding code in the output.

About

A fork of pbf, the fast, ultra-lightweight (3KB gzipped) JavaScript library for decoding and encoding protocol buffers, but built for ESM-based projects

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages