pure javascript serial port implementation for node.js, electron and nw.js.
Install
Usage
Methods
find()
Type:
Promise<Object[]|Error>
Async function that returns a promise.When resolved it contains a list of the registered serial devices.
findById(id)
Id:
String
Type: Promise<Object|Error>
Async function that returns a promise.When resolved it contains the found serial device or
null
whennot found.![Port Port](https://i.ytimg.com/vi/rhagmAv35Kk/maxresdefault.jpg)
![Read Data From Serial Port Javascript Replace Read Data From Serial Port Javascript Replace](https://s3-ap-southeast-1.amazonaws.com/a2.datacaciques.com/wm/NDAy/3849027817/3602695677.jpg)
open(path, delimiter = 'rn')
Type:
Promise<EventEmitter|Error>
Opens a Duplex connection to the serial device.Returns the Port(event.EventEmitter) Object
Port Events
data
Type:
String
The data that has been read out of the serial connection.
error
The error that occured.
closed
Is emitted when the connection is closed.
Port Methods
port.send(data)
Sends the data to the serial device.
port.close();
Linux Read Data From Serial Port
Closes the connection to the serial device.When closed, the event
closed
is emitted.Port Variables
- isOpen
- serialPort
Read Data From Serial Port Javascript Replace String
#node-webkit, nw.js, and seperate node.js thread examples*The only difference with this is that the user must have node installed. It will spawn a node proxy using their local node version and run the pure js serialport implementation. This is great for consumer facing products as there is no need for compilers or dev tools to install the module with your app, users just need node.