https://github.com/pocesar/node-packet-frame
Easy streaming packet framing and serialization
https://github.com/pocesar/node-packet-frame
Last synced: 6 days ago
JSON representation
Easy streaming packet framing and serialization
- Host: GitHub
- URL: https://github.com/pocesar/node-packet-frame
- Owner: pocesar
- License: mit
- Created: 2014-02-28T05:11:36.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-24T01:41:12.000Z (over 9 years ago)
- Last Synced: 2024-10-18T06:28:25.279Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/pocesar/node-packet-frame)
[](https://coveralls.io/github/pocesar/node-packet-frame?branch=master)
[](https://david-dm.org/pocesar/node-packet-frame)[](https://nodei.co/npm/packet-frame/)
Packet Frame
===========Easy streaming packet framing and serialization.
# Install
```bash
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?
```es6
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