Whether baudRate may be set to a value outside the standard set. Default is false.
The baud rate, in bits per second. Default is 115200.
Setting a non-standard value (i.e. not one of 300, 1200, 2400, 4800, 9600, 14400,
19200, 28800, 38400, 57600, 115200, 230400) is rejected unless allowNonStandardBaudRates
is true.
The number of data bits, 5–8. Default is 8.
The state of the DTR (Data Terminal Ready) control line. Default is false.
ReadonlyidentifierThe unique identifier assigned to this port object.
ReadonlyisWhether the port is currently open.
ReadonlynameThe port's name (e.g. "usbserial-1420").
The parity mode: "none", "odd", or "even". Default is "none".
ReadonlypathThe port's device path (e.g. "/dev/cu.usbserial-1420").
The state of the RTS (Request To Send) control line. Default is false.
Whether data sent with sendData() is also delivered back to the callback
as a "received" event, simulating local echo. Default is false.
The number of stop bits, 1 or 2. Default is 1.
Whether to use hardware DTR/DSR flow control. Default is false.
Whether to use hardware RTS/CTS flow control. Default is false.
Closes the port and releases all resources. Called automatically during shutdown.
Sends data through the port.
The string is transmitted as raw bytes: each character's code point (0–255) becomes
one byte on the wire. This lets you round-trip arbitrary binary data — build the string
with String.fromCharCode() for non-text payloads.
The data to send
self, for chaining
Sets the callback invoked for port lifecycle events and received data. The callback receives two arguments: an event type string and a data string.
Called on port events
self, for chaining
A serial port, created via
hs.serial.createPortNamed()orhs.serial.createPortAtPath(). The port is not open until you callopen(). Configure it (baud rate, data bits, etc.) either before or after opening — configuration changes made while open are applied immediately. Received data, and lifecycle events, are delivered via the callback registered withsetCallback().