Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 708 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 708 Bytes

protobufjs/ext/descriptor

Experimental protobuf.js extension for interoperability with descriptor.proto types.

Usage

var protobuf   = require("protobufjs"),
    descriptor = require("protobufjs/ext/descriptor");

var descriptor = ...; // either a FieldDescriptorSet buffer or JSON object
var root = protobuf.Root.fromDescriptor(descriptor);
var rootDescriptor = root.toDescriptor("proto3");

API

The extension adds .fromDescriptor(descriptor[, syntax]) and #toDescriptor([syntax]) methods to reflection objects and exports the internally used Root instance that contains the types present in descriptor.proto.