Package Exports
- protons
- protons/status
Readme
protons
Generate typescript from .proto files
Table of contents
Install
To use this project, add protons
as a development dependency and protons-runtime
as a runtime dependency.
protons
contains the code to compile .proto
files to .ts
files and protons-runtime
contains the code to do serialization/deserialization to Uint8Array
s during application execution.
$ npm install --save-dev protons
$ npm install --save protons-runtime
Usage
First generate your .ts
files:
$ protons ./path/to/foo.proto ./path/to/output.ts
Then run tsc over them as normal:
$ tsc
In your code import the generated classes and use them to transform to/from bytes:
import { Foo } from './foo.js'
const foo = {
message: 'hello world'
}
const encoded = Foo.encode(foo)
const decoded = Foo.decode(encoded)
console.info(decoded.message)
// 'hello world'
Contribute
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
License
Apache-2.0 or MIT © Protocol Labs