@ollion/protobufjs-typescript-gen
v2.0.7
Published
<a href="https://npmjs.org/package/@cldcvr/protobufjs-typescript-gen"><img src="https://img.shields.io/npm/v/@cldcvr/protobufjs-typescript-gen.svg" alt=""></a> <a href="https://npmjs.org/package/@cldcvr/protobufjs-typescript-gen"><img src="https://img.shi
Downloads
250
Readme
@cldcvr/protobufjs-typescript-gen
@cldcvr/protobufjs-typescript-gen is a tool which used protocol buffers to generate a Typescript interface. The tool is currently highly opinionated in how it generates files. It internally uses protobuf.js.
protobuf.js is a pure JavaScript implementation with TypeScript support for node.js and the browser. It's easy to use, blazingly fast and works out of the box with .proto files!
Installation
node.js
$> npm install @cldcvr/protobufjs-typescript-gen [--save --save-prefix=~]
// generate-protocol.js
const { generateProtocol } = require('@cldcvr/protobufjs-typescript-gen');
generateProtocol({
protocolDir: 'YOUR_PROTOCOL_DIRECTORY',
outDir: 'YOUR_OUTPUT_DIRECTORY',
});
$> node generate-protocol.js
Example
Please see the examples folder for the structure of the generated interface.