New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

protomini

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protomini

Minimize and optimize and simplify and miniaturize your network packets for optimal speed and efficiency with ProtoMini.

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

ProtoMini

ProtoMini Logo

npm version Build Status License: MIT

Description

Minimize and optimize your network packets for optimal speed and efficiency with ProtoMini.

Features

  • 🚀 Fast encoding and decoding
  • 📦 Simple API
  • 🛠 TypeScript support
  • 🎮 Perfect for real-time game development
  • 🌐 Minimize network latency

Installation

npm install protomini

Usage

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"

API Reference

type KeyMapping = { [key: string]: string };
type Primitive = string | number | BigInt | boolean;
type Encodable = Primitive | Encodable[] | { [key: string]: Encodable };

constructor(keysMapping: KeyMapping)

Initialize a new ProtoMini instance.

encodePacket(packet: Encodable): string

Encode a packet.

decodePacket(encodedPacket: string): Encodable

Decode an encoded packet.

Tests

Run tests using Jest:

npm test

License

MIT

Author

👤 car1ot

Support

Raise an issue here for any bugs or feature requests.

Keywords

networking

FAQs

Package last updated on 26 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts