A JS library for talking with any gRPC Server that implements Reflection protocol.
Install with npm:
npm install grpc-reflection-js @grpc/grpc-js
Install with yarn:
yarn add grpc-reflection-js @grpc/grpc-js
- Initialize client
- listServices: List gRPC services
- fileContainingSymbol: Get protobuf Root using fully-qualified symbol name
- fileByFilename: Get protobuf Root using proto file name
const grpc = require('grpc');
const grpcReflection = require('grpc-reflection-js');
const grpcReflectionServer = '<gRPC Reflection server host>'
const reflectionClient = new grpcReflection.Client(
grpcReflectionServer,
grpc.credentials.createInsecure()
);
const services = await reflectionClient.listServices()
Output
['grpc.reflection.v1alpha.ServerReflection', 'phone.Messenger']
const root = await reflectionClient.fileContainingSymbol('phone.Messenger')
const root = await reflectionClient.fileContainingSymbol('contact.proto')
MIT