0.7.0 • Published 8 months ago

@alepha/protobuf v0.7.0

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

8 months ago

0.6.10

8 months ago

0.6.9

8 months ago

0.6.8

9 months ago

0.6.7

9 months ago

0.6.6

9 months ago

0.6.5

9 months ago

0.6.4

9 months ago

0.6.3

9 months ago

0.6.2

9 months ago

0.6.1

9 months ago

0.6.0

10 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.5.0

10 months ago