# protoflex

> Arbitrary Protobuf (de-)serializing library

Latest version **0.3.0** (published 2021-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install protoflex
pnpm add protoflex
yarn add protoflex
bun add protoflex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2021-09-19 |
| First published | 2019-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 431.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | teidesu |
| Maintainers | teidesu |

## Links

- npm: https://www.npmjs.com/package/protoflex
- npm.io page: https://npm.io/package/protoflex

## Dependencies (2)

- [long](https://npm.io/package/long.md) ^4.0.0
- [@types/long](https://npm.io/package/@types/long.md) ^4.0.0

## Recent versions

- 0.3.0 (latest) — 2021-09-19
- 0.2.1 — 2020-08-25
- 0.2.0 — 2020-08-25
- 0.1.2 — 2020-06-11
- 0.1.1 — 2019-12-10

## README

# Protoflex
![downloads](https://img.shields.io/npm/dm/protoflex) 
![version](https://img.shields.io/npm/v/protoflex) 
![.min.js file size](https://img.shields.io/github/size/teidesu/protoflex/dist/protoflex.min.js)

Protoflex is a modern JavaScript library for working with arbitrary Protobuf data.

Online REPL: [here](https://teidesu.github.io/protoflex/repl)

# Why?
There were 2 main reasons for creating Protoflex:
 - Debugging/reversing Protobuf HTTP(s) APIs
 - Using Protobuf in relatively small scripts

So, Protoflex does its best to fit them both. 

**WARNING**: this library is **not recommended for production apps**

# Quick start:
## Reading (deserializing)
```javascript
const PB = require('protoflex')
const data = require('protoflex/utils').fromHex('082a')
console.log(PB.parse(data).int32(1))  // 42
```
or via [JSON API](#json-api):
```javascript
const PB = require('protoflex')
const data = require('protoflex/utils').fromHex('082a')
console.log(PB.parse(data).toJSON()) // { '1': '42' }
```
## Writing (serializing)
```javascript
const PB = require('protoflex')
let msg = PB
    .create()
    .int32(1, 42)
console.log(msg.serialize())  // [0x08, 0x2a]
```
or via [JSON API](#json-api):
```javascript
const PB = require('protoflex')
let msg = PB.fromJson({
    1: 42
})
console.log(msg.serialize())  // [0x08, 0x2a]
```

# API Documentation:
Full API reference can be found here: 
[https://teidesu.github.io/protoflex/api](https://teidesu.github.io/protoflex/api)

---
_Source: https://npm.io/package/protoflex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
