https://github.com/redhoyasa/grpc-reflection-js
gRPC Reflection client for JS
https://github.com/redhoyasa/grpc-reflection-js
grpc javascript node protobuf
Last synced: 4 months ago
JSON representation
gRPC Reflection client for JS
- Host: GitHub
- URL: https://github.com/redhoyasa/grpc-reflection-js
- Owner: redhoyasa
- License: mit
- Created: 2020-06-09T02:24:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-03T19:46:00.000Z (almost 2 years ago)
- Last Synced: 2025-03-02T13:12:31.598Z (over 1 year ago)
- Topics: grpc, javascript, node, protobuf
- Language: JavaScript
- Homepage:
- Size: 1.47 MB
- Stars: 20
- Watchers: 2
- Forks: 16
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-grpc - grpc-reflection-js
- awesome-list - grpc-reflection-js
README
# gRPC Reflection JS
[](https://badge.fury.io/js/grpc-reflection-js)

[](https://codecov.io/gh/redhoyasa/grpc-reflection-js)
A JS library for talking with any gRPC Server that implements [Reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) protocol.
## Installation
Install with npm:
```sh
npm install grpc-reflection-js @grpc/grpc-js
```
Install with yarn:
```sh
yarn add grpc-reflection-js @grpc/grpc-js
```
## Usage
- [Initialize client](#Initialize)
- [listServices](#listServices): List gRPC services
- [fileContainingSymbol](#fileContainingSymbol): Get protobuf Root using fully-qualified symbol name
- [fileByFilename](#fileByFilename): Get protobuf Root using proto file name
### Initialize
```js
const grpc = require('grpc');
const grpcReflection = require('grpc-reflection-js');
const grpcReflectionServer = ''
const reflectionClient = new grpcReflection.Client(
grpcReflectionServer,
grpc.credentials.createInsecure()
);
```
### listServices
```js
const services = await reflectionClient.listServices()
```
Output
```text
['grpc.reflection.v1alpha.ServerReflection', 'phone.Messenger']
```
### fileContainingSymbol
```js
const root = await reflectionClient.fileContainingSymbol('phone.Messenger')
```
### fileByFilename
```js
const root = await reflectionClient.fileContainingSymbol('contact.proto')
```
## License
[](https://raw.githubusercontent.com/apollostack/apollo-ios/master/LICENSE)
MIT