Socket
Socket
Sign inDemoInstall

protons

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protons

Protobuf to ts transpiler


Version published
Weekly downloads
16K
decreased by-2.86%
Maintainers
4
Weekly downloads
 
Created
Source

protons

ipfs.io IRC Discord codecov CI

Protobuf to ts transpiler

Table of contents

Install

$ npm i protons

protons contains the code to compile .proto files to .ts files and protons-runtime contains the code to do serialization/deserialization to Uint8Arrays 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

Licensed under either of

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

FAQs

Package last updated on 30 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc