0.1.0 • Published 10 years ago

serial-port-stream v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

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) or
  • SerialPortStream(path, options);

Options:

  • autoClose — auto close on finish, 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