@sv-tools/protoc-gen-ts-pblite
v0.1.0-alpha.4
Published
protoc plugin to generate typescript files that use the PBLite JSON format as storage
Downloads
56
Readme
protoc-gen-ts-pblite
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.
Options
--ts-pblite_opt=generic
(default)
Generate serialize()
methods using the google-protobuf
API.
--ts-pblite_opt=url
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
License
MIT · ⓒ 2022 Renée Kooi