How to use the protodef.FullPacketParser function in protodef

To help you get started, we’ve selected a few protodef examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MephisTools / diablo2-protocol / examples / tools / loadDump.js View on Github external
const {
  createSplitter,
  decompress,
  d2gsProtocol,
  d2gsReader
} = require('../..')

const ProtoDef = require('protodef').ProtoDef
const FullPacketParser = require('protodef').FullPacketParser

const protoToClient = new ProtoDef(false)
protoToClient.addTypes(d2gsReader)
protoToClient.addProtocol(d2gsProtocol, ['toClient'])

const parser = new FullPacketParser(protoToClient, 'packet')

parser.on('error', err => console.log('d2gsToClient error : ', err.message))

const splitter = createSplitter()

const fs = require('fs')

const dumpFile = fs.readFileSync('./d2gs.dump')

console.log(dumpFile.slice(0, 7))

const cleanedDumpFile = dumpFile.slice(7)
console.log(cleanedDumpFile.length)

async function load () {
  let lastOffset = 0
github PrismarineJS / node-minecraft-protocol / src / transforms / serializer.js View on Github external
function createDeserializer ({ state = states.HANDSHAKING, isServer = false, version, customPackets } = {}) {
  return new Parser(createProtocol(state, isServer ? 'toServer' : 'toClient', version, customPackets), 'packet')
}

protodef

A simple yet powerful way to define binary protocols

MIT
Latest version published 13 days ago

Package Health Score

81 / 100
Full package analysis