Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-03T19:46:00.000Z (6 months ago)
- Last Synced: 2024-11-05T22:09:20.577Z (3 months ago)
- Topics: grpc, javascript, node, protobuf
- Language: JavaScript
- Homepage:
- Size: 1.47 MB
- Stars: 20
- Watchers: 2
- Forks: 14
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - grpc-reflection-js
- awesome-grpc - grpc-reflection-js
README
# 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/branch/master/graph/badge.svg)](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
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg?maxAge=2592000)](https://raw.githubusercontent.com/apollostack/apollo-ios/master/LICENSE)
MIT