Skip to content

pocesar/node-packet-frame

Repository files navigation

Build Status Coverage Status Dependency Status

NPM

Packet Frame

Easy streaming packet framing and serialization.

Install

npm install packet-frame

What?

Framing a packet means wrapping the payload with a header and checksums to ensure they are valid, and having it's size set.

The frames are limited to 65k (uint16), a "magic" version is added, along with CRC32 to the header and to the payload, recursively.

You can choose to drop invalid payloads, or deal with it manually.

How?

import { Parser } from 'packet-frame'

var stream = Parser.createStream({
    policy: 'drop' // default
})

net.createServer((socket) => {
    socket.pipe(stream).pipe(socket); // only the valid data is echoed back
})

License

MIT

About

Easy streaming packet framing and serialization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published