Minimize and optimize your network packets for optimal speed and efficiency with ProtoMini.
- 🚀 Fast encoding and decoding
- 📦 Simple API
- 🛠 TypeScript support
- 🎮 Perfect for real-time game development
- 🌐 Minimize network latency
npm install protomini
import { ProtoMini } from 'protomini';
// Setup ProtoMini
const keyToValueMap = { foo: "f", bar: "b" };
const protoMini = new ProtoMini(keyToValueMap);
// Do magic encode/decode your json
const originalPacket = { foo: ["bar", { bar: "bar" }] };
const encodedPacket = protoMini.encodePacket(originalPacket); // {"f":["b",{"b":"b"}}}
const decodedPacket = protoMini.decodePacket(encodedPacket); // {"foo":["bar",{"bar":"bar"}]}
// Also it doing magic encode/decode your text
const originalText = "foo omg, yeah, bar bar, so-so";
const encodedPacket = protoMini.encodePacket(originalText); // "f omg, yeah, b b, so-so"
const decodedPacket = protoMini.decodePacket(encodedPacket); // "foo omg, yeah, bar bar, so-so"
type KeyMapping = { [key: string]: string };
type Primitive = string | number | BigInt | boolean;
type Encodable = Primitive | Encodable[] | { [key: string]: Encodable };
Initialize a new ProtoMini instance.
Encode a packet.
Decode an encoded packet.
Run tests using Jest:
npm test
👤 car1ot
Raise an issue here for any bugs or feature requests.