node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

libserialport

libserialport for node

A binding to libserialport by the Sigrok project for Node.

Install

npm install libserialport

Binary versions are provided for Windows and OS X. Linux requires node-gyp.

Run

var libserialport = require('libserialport');
 
libserialport.list(function (err, ports) {
    console.log(ports) // [ { path: '/dev/cu.usbmodem1411', ... } ] 
 
    var serial = libserialport.open(ports[0])
    serial.on('data', function (data) {
        process.stdout.write(data);
    })
    serial.on('cts', function (cts) {
        // cts line changed 
    })
    serial.close();
})

License

LGPL3+ license.