1.0.1 • Published 8 years ago

bsplit v1.0.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
8 years ago

bsplit

bsplit Build Status Dependencies Status


What

A light, dependency-less binary stream splitter for kalm transports.

It acts like a stream, emitting 'data' events, and implementing 'write' and 'end' functions while splitting payloads by a given character or \n by default.

Output is a UINT8 array (easier for internal deserialization).

Usage

const bsplit = require('bsplit');

const socket = net.connect(...);
const stream = socket.pipe(bsplit());
stream.on('data', (data) => console.log(String.fromCharCode.apply(null, data)));

Where bsplit() can take an argument corresponding to the byte to split on.