Compile .proto
files to simple, dependency-free TypeScript classes, for use with Google's PBLite format.
- Messages become typescript classes.
- Enums become typescript enums.
- Fields become getters/setter properties.
- The output does not have a dependency on
google-protobuf
.
PBLite is the format used for storage by google-protobuf
and for data transfer by some Google GRPC services. It encodes protobuf messages as nested JSON arrays.
Generate serialize()
methods using the google-protobuf
API.
Generate standalone stringify${MessageName}
functions that serialize to Google's PBLite URL string format.
import { stringifyTilePanoramasRequest, TilePanoramasRequest } from './protos'
declare const request: TilePanoramasRequest
const pb: string = stringifyTilePanoramasRequest(request)
const query = new URLSearchParams(['pb', pb])
// Use in a URL
Using the URL format requires installing this base64 package to handle
bytes
fields:npm install @jsonjoy.com/base64@^1.0.0
MIT · ⓒ 2022 Renée Kooi