grpc-reflection-js

[![npm version](https://badge.fury.io/js/grpc-reflection-js.svg)](https://badge.fury.io/js/grpc-reflection-js) ![CI](https://github.com/redhoyasa/grpc-reflection-js/workflows/CI/badge.svg) [![codecov](https://codecov.io/gh/redhoyasa/grpc-reflection-js/bra

Usage no npm install needed!

<script type="module">
  import grpcReflectionJs from 'https://cdn.skypack.dev/grpc-reflection-js';
</script>

README

gRPC Reflection JS

npm version CI codecov

A JS library for talking with any gRPC Server that implements Reflection protocol.

Installation

Install with npm:

npm install grpc-reflection-js @grpc/grpc-js

Install with yarn:

yarn add grpc-reflection-js @grpc/grpc-js

Usage

Initialize

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()
);

listServices

const services = await reflectionClient.listServices()

Output

['grpc.reflection.v1alpha.ServerReflection', 'phone.Messenger']

fileContainingSymbol

const root = await reflectionClient.fileContainingSymbol('phone.Messenger')

fileByFilename

const root = await reflectionClient.fileContainingSymbol('contact.proto')

License

GitHub license

MIT