# 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

Latest version **0.3.0** (published 2023-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install grpc-reflection-js
pnpm add grpc-reflection-js
yarn add grpc-reflection-js
bun add grpc-reflection-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2023-08-05 |
| First published | 2020-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 160.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | redhoyasa@gmail.com |
| Maintainers | redhoyasa |
| Keywords | grpc, gRPC |

## Links

- npm: https://www.npmjs.com/package/grpc-reflection-js
- Repository: https://github.com/redhoyasa/grpc-reflection-js
- Homepage: https://github.com/redhoyasa/grpc-reflection-js#readme
- Issues: https://github.com/redhoyasa/grpc-reflection-js/issues
- npm.io page: https://npm.io/package/grpc-reflection-js

## Dependencies (5)

- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [protobufjs](https://npm.io/package/protobufjs.md) ^7.2.2
- [google-protobuf](https://npm.io/package/google-protobuf.md) ^3.12.2
- [@types/lodash.set](https://npm.io/package/@types/lodash.set.md) ^4.3.6
- [@types/google-protobuf](https://npm.io/package/@types/google-protobuf.md) ^3.7.2

## Recent versions

- 0.3.0 (latest) — 2023-08-05
- 0.2.0 — 2023-07-24
- 0.1.2 — 2021-06-16
- 0.1.1 — 2021-02-18
- 0.1.0 — 2021-02-13
- 0.0.7 — 2020-10-29
- 0.0.5 — 2020-09-15
- 0.0.3 — 2020-06-30
- 0.0.2 — 2020-06-30

## 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 = '<gRPC Reflection server host>'
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

---
_Source: https://npm.io/package/grpc-reflection-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
