0.7.0 • Published 1 year ago

@alepha/protobuf v0.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.6.10

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.6.7

1 year ago

0.6.6

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago