0.7.0 • Published 10 months ago

@alepha/protobuf v0.7.0

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

10 months ago

0.6.10

10 months ago

0.6.9

10 months ago

0.6.8

10 months ago

0.6.7

10 months ago

0.6.6

10 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.3

10 months ago

0.6.2

11 months ago

0.6.1

11 months ago

0.6.0

11 months ago

0.5.2

11 months ago

0.5.1

11 months ago

0.5.0

11 months ago