Streams2 frontend for node-serialport
Switch branches/tags
Nothing to show
Latest commit 212a3fc Jul 22, 2013 @mharsch README fix
Failed to load latest commit information.
test fold tx/rx into a Duplex stream Jul 22, 2013 README fix Jul 22, 2013
index.js fixup README and passthrough api Jul 22, 2013
package.json README fix Jul 22, 2013


A Streams2 frontend for node-serialport.


The S2Serial implements the same API as node-serialport except:

  • The parser option is ignored (forcing raw mode)
  • The returned object implements a Duplex Stream


var S2Serial = require('s2serial').S2Serial;
var sp = new S2Serial('/dev/tty.usb411', {baudrate: 57600});

// hypothetical Streams that implement some protocol
var encoder = new MyEncoder(); // encodes command objs into bytes
var decoder = new MyDecoder(); // parses stream of bytes and emits objs

decoder.on('message', function (msg) {
	console.log('message received from serialport: ' + msg);

sp.on('open', function () {
	encoder.send({ cmd: 'getsomething' });