@nsnanocat/grpc
v1.1.0
Published
Pure JS's gRPC decode/encode module for well-known iOS network tools
Maintainers
Readme
gRPC
Pure JS gRPC encode/decode helpers for well-known iOS network tools.
API
decode(bytesBody)
Decode the existing raw gRPC binary frame used by this package and return protobuf body bytes.
encode(body, encoding)
Encode protobuf body bytes into the existing raw gRPC binary frame used by this package.
decodeWeb(bytesBody)
Decode a grpc-web binary unary response body and return:
{
header: {
"grpc-status": "0"
},
bodyBytes: Uint8Array
}header contains the key-value pairs parsed from the grpc-web trailer frame. bodyBytes contains the protobuf payload after optional gzip decompression.
Limitations
decodeWebonly supports grpc-web binary unary responses.decodeWebdoes not support grpc-web-text.decodeWebtreats trailer metadata from the body trailer frame asheader; it does not parse transport-level HTTP response headers.
