Serial port as a duplex stream.
Works in node via node-serialport and in chrome with browserify via chrome.serial
- auto open;
- auto close;
- real
Duplex
stream; - work with browserify in chrome extensions and apps.
npm install serial-port-stream
and then:
var SerialPortStream = require('serial-port-stream');
new SerialPortStream(path, options)
orSerialPortStream(path, options)
;
autoClose
โ auto close onfinish
,true
by default;baudRate
;dataBits
;stopBits
;parity
.
close
;destroy
.
Just like fs
streams.
open
;close
;error
.
var SerialPortStream = require('serial-port-stream');
var stream = new SerialPortStream('/dev/ttyUSB0', { baudRate : 9600 });
stream.end('Hello world!\n');
MIT