0.1.0 • Published 11 years ago
serial-port-stream v0.1.0
serial-port-stream
Serial port as a duplex stream.
Works in node via node-serialport and in chrome with browserify via chrome.serial
Features:
- auto open;
- auto close;
- real
Duplex
stream; - work with browserify in chrome extensions and apps.
Install
npm install serial-port-stream
and then:
var SerialPortStream = require('serial-port-stream');
Usage:
new SerialPortStream(path, options)
orSerialPortStream(path, options)
;
Options:
autoClose
— auto close onfinish
,true
by default;baudRate
;dataBits
;stopBits
;parity
.
Methods:
close
;destroy
.
Just like fs
streams.
Events:
open
;close
;error
.
Example:
var SerialPortStream = require('serial-port-stream');
var stream = new SerialPortStream('/dev/ttyUSB0', { baudRate : 9600 });
stream.end('Hello world!\n');
License
MIT