# protodef

> A simple yet powerful way to define binary protocols

Latest version **1.19.0** (published 2025-04-06) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.19.0 |
| Published | 2025-04-06 |
| First published | 2015-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 3 |
| Unpacked size | 185.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | roblabla |
| Maintainers | rom1504, roblabla |

## Links

- npm: https://www.npmjs.com/package/protodef
- Repository: https://github.com/ProtoDef-io/node-protodef
- Issues: https://github.com/ProtoDef-io/node-protodef/issues
- npm.io page: https://npm.io/package/protodef

## Dependencies (3)

- [lodash.reduce](https://npm.io/package/lodash.reduce.md) ^4.6.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^4.4.0
- [protodef-validator](https://npm.io/package/protodef-validator.md) ^1.3.0

## Recent versions

- 1.19.0 (latest) — 2025-04-06
- 1.18.0 — 2024-12-09
- 1.17.0 — 2024-10-12
- 1.16.0 — 2024-10-12
- 1.15.0 — 2022-02-12
- 1.14.0 — 2021-06-09
- 1.13.0 — 2021-04-08
- 1.12.1 — 2021-04-01
- 1.12.0 — 2021-04-01
- 1.11.0 — 2021-03-14
- 1.10.0 — 2021-03-11
- 1.9.0 — 2021-02-09
- 1.8.3 — 2020-10-26
- 1.8.2 — 2020-07-11
- 1.8.1 — 2020-07-08
- … 41 more at https://npm.io/package/protodef/versions

## README

# ProtoDef
[![NPM version](https://img.shields.io/npm/v/protodef.svg)](http://npmjs.com/package/protodef)
[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8)
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-brightgreen.svg)](https://gitter.im/PrismarineJS/general)
[![Irc](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://irc.gitter.im/)
[![Build Status](https://github.com/ProtoDef-io/node-protodef/workflows/CI/badge.svg)](https://github.com/ProtoDef-io/node-protodef/actions?query=workflow%3A%22CI%22)
[![Tonic](https://img.shields.io/badge/tonic-try%20it-blue.svg)](https://tonicdev.com/npm/protodef)
[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/ProtoDef-io/node-protodef)

This is a node.js module to simplify defining, reading and writing binary blobs,
whether they be internet protocols or files.

## Installing

```
npm install ProtoDef
```


## Usage

See [example](example.js)

## Documentation

See the language independent [ProtoDef](https://github.com/ProtoDef-io/ProtoDef) specification.

* [api.md](doc/api.md) documents the exposed functions and classes
* [compiler.md](doc/compiler.md) documents the ProtoDef Compiler
* [datatypes.md](https://github.com/ProtoDef-io/ProtoDef/blob/master/doc/datatypes.md) documents the default datatypes provided by Protodef.
* [newDatatypes.md](doc/newDatatypes.md) explains how to create new datatypes for protodef
* [history.md](doc/history.md) is the releases history

## Projects Using ProtoDef

* [minecraft-protocol](https://github.com/PrismarineJS/node-minecraft-protocol) defines a protocol.json by minecraft version and use ProtoDef to serialize and parse packets
  * the protocol.json files are stored in [minecraft-data](https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.8/protocol.json)
  * and they can be visualized automatically in this [doc](http://prismarinejs.github.io/minecraft-data/?d=protocol)
* [prismarine-nbt](https://github.com/PrismarineJS/prismarine-nbt) defined a nbt.json to parse and serialize the NBT format
* [mineflayer](https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/command_block.js) uses ProtoDef to parse plugin messages
* [minecraft-protocol-forge](https://github.com/PrismarineJS/node-minecraft-protocol-forge) parses and serialize forge plugin messages
* [node-raknet](https://github.com/mhsjlw/node-raknet) describe the raknet protocol in a protocol.json and uses ProtoDef to read it
* [minecraft-classic-protocol](https://github.com/mhsjlw/minecraft-classic-protocol) defines the classic minecraft protocol with ProtoDef
* [pocket-minecraft-protocol](https://github.com/mhsjlw/pocket-minecraft-protocol) defines the minecraft pocket edition protocol
* [diablo2-protocol](https://github.com/MephisTools/diablo2-protocol) Diablo 2 network protocol
* [dofus-protocol](https://github.com/AstrubTools/dofus-protocol) Network protocol for dofus : create client and servers for dofus 1.30

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