Registry / devops / cool-grpc

cool-grpc

JSON →
library1.2.3jsnpmunverified

A simple, stupid gRPC client for Node.js written in TypeScript. Version 1.2.3. Provides a fetch/got-like API for making gRPC calls with support for loading multiple .proto files, automatic message encoding/decoding, unary calls, client streaming, server streaming, and hooks. Differentiates from other gRPC clients by its minimalistic interface and TypeScript support.

npm install cool-grpc
INSTALL
IMPORT
SIG · COOL-GRPC
C
cool-grpc
devopsjavascriptv1.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

makeRequest
import { makeRequest } from 'cool-grpc'
const makeRequest = require('cool-grpc')
ESM-only; use named import.
makeRequest
import { makeRequest } from 'cool-grpc'
import makeRequest from 'cool-grpc'
Default export is not available; always use named import.
makeRequest
const { makeRequest } = await import('cool-grpc')
const { makeRequest } = require('cool-grpc')
Dynamic import works with ESM.

Shows how to make a simple unary gRPC call using cool-grpc with a .proto file.

import { makeRequest } from 'cool-grpc' const protos = ['./helloworld.proto'] makeRequest(protos, { host: '0.0.0.0:50051', service: 'helloworld.Greeter', method: 'SayHello', data: { name: 'world' } }) .then(console.log) .catch(console.error)
Debug
Known issues
gotchamakeRequest requires an array of .proto file paths; single string may fail.
fix
Always pass an array: ['./my.proto'] even for a single file.
affects: >=1.0.0
gotchaThe 'host' option must not include protocol prefix (http://).
fix
Use '0.0.0.0:50051' not 'http://0.0.0.0:50051'.
affects: >=1.0.0
breakingv1.0.0 changed from callback-based to promise-based API.
fix
Migrate from callbacks to await/promises.
affects: <1.0.0
Errors
Common errors & fixes
TypeError: makeRequest is not a function
Incorrect import style (default instead of named).
fix
Use import { makeRequest } from 'cool-grpc'.
Error: ENOENT: no such file or directory, open 'my.proto'
Proto file path is relative to current working directory, not the script location.
fix
Use absolute paths or resolve relative to __dirname: path.join(__dirname, 'my.proto').
Error: Method not found: helloworld.Greeter/SayHello
Service or method name mismatch in proto file.
fix
Verify the service and method names match exactly as defined in .proto, including casing.
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC runtime library for Node.js
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
cool-grpc — npm install cool-grpc · libregistry