Skip to content

redhoyasa/grpc-reflection-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

92c5016 · Aug 5, 2023

History

81 Commits
Aug 5, 2023
Jul 17, 2023
Jun 9, 2020
Jul 17, 2023
Jun 22, 2020
Jun 22, 2020
Feb 13, 2021
Jun 26, 2020
Jun 9, 2020
Jun 9, 2020
Jun 19, 2020
Jun 16, 2021
Feb 18, 2021
Aug 5, 2023
Jun 18, 2020
Jul 25, 2023

Repository files navigation

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