0.7.0 • Published 5 months ago

@alepha/protobuf v0.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@alepha/protobuf

Alepha Protobuf is a simple protobuf adapter for Alepha. It uses TypeBox Schema to define the protobuf schema and serialize/deserialize the data.

Installation

npm install @alepha/protobuf

Usage

import { Alepha, t } from "@alepha/core";
import { ProtobufProvider } from "@alepha/protobuf";

const protobuf = Alepha.create().get(ProtobufProvider);

const userSchema = t.object({
	username: t.string(),
	createdAt: t.datetime(),
	age: t.int(),
	isActive: t.boolean()
});

const buffer = protobuf.encode(userSchema, {
	username: "John Doe",
	createdAt: new Date().toISOString(),
	age: 30,
	isActive: true
});

const user = protobuf.decode(userSchema, buffer);
0.7.0

5 months ago

0.6.10

6 months ago

0.6.9

6 months ago

0.6.8

6 months ago

0.6.7

6 months ago

0.6.6

6 months ago

0.6.5

6 months ago

0.6.4

6 months ago

0.6.3

6 months ago

0.6.2

6 months ago

0.6.1

6 months ago

0.6.0

7 months ago

0.5.2

7 months ago

0.5.1

7 months ago

0.5.0

7 months ago