grpc-pbf-loader
v1.1.6
Published
A utility package for loading .proto files for use with gRPC, using pbf as a serializer
Downloads
20
Maintainers
Readme
grpc-pbf-loader
A utility package for loading .proto
files for use with gRPC, using pbf as a serializer.
Installation
npm i grpc-pbf-loader
Usage
const packageDefinitionLoader = require("grpc-pbf-loader").packageDefinition;
const grpcLibrary = require("grpc");
// OR
const grpcLibrary = require("@grpc/grpc-js");
const packageDefinition = await packageDefinitionLoader.load(protoFileName, options);
const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);
// OR
const packageDefinition = packageDefinitionLoader.loadSync(protoFileName, options);
const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);
The options parameter is an object that can have the following optional properties:
| Field name | Valid values | Description |
| ------------- | ------------------- | ------------------------------------------------------------------ |
| keepCase
| true
or false
| Preserve field names. The default is to change them to camel case. |
| includeDirs
| An array of strings | A list of search paths for imported .proto
files. |