v1.0 · MIT · Linux · macOS · Windows
Talk to hardware. From JavaScript.
A composable serial-port toolkit for Node.js. Open a port, pipe its stream through a parser, and ship the result. Native bindings handle the wire; mocks let you test without one.
- Packages
- 21
- Parsers
- 11
- Bindings
- C++ · Mock · Rust
- Node
- ≥ 20
/01 — what you get
A small core, with the right edges sharpened.
- 01
Cross-platform, native.
N-API bindings compiled for Linux, macOS and Windows — with prebuilds, so consumers don't need a toolchain. A Rust crate ships alongside.
- 02
Eleven parsers, one stream.
Readline, delimiter, byte-length, regex, packet-length, ccTalk, SLIP, Space Packet — pipe raw bytes into the shape your protocol expects.
- 03
Built for the messy world.
Auto-reconnect for flaky USB cables. A request/response queue for AT commands, Modbus RTU, ccTalk. Strongly-typed errors throughout.
- 04
Tools, not just APIs.
serialpilot-list,serialpilot-terminal, andserialpilot-replship as binaries. Discover ports, talk to them, script against them.
/02 — first contact
From npm install to first byte.
# Install the meta package — bindings, stream, parsers $ npm install serialpilot # Or pick what you need $ npm install @serialpilot/bindings-cpp @serialpilot/stream $ npm install @serialpilot/parser-readline
import { SerialPilot, ReadlineParser } from 'serialpilot' const port = new SerialPilot({ path: '/dev/tty.usbmodem1421', baudRate: 115200, }) const lines = port.pipe(new ReadlineParser({ delimiter: '\n' })) lines.on('data', line => { console.log('<-', line) }) port.write('PING\n')
import { SerialPilotMock, ReadlineParser } from 'serialpilot' import { MockBinding } from '@serialpilot/binding-mock' MockBinding.createPort('/dev/ROBOT', { echo: true }) const port = new SerialPilotMock({ path: '/dev/ROBOT', baudRate: 9600 }) const lines = port.pipe(new ReadlineParser({ delimiter: '\n' })) port.write('hello\n') // lines emits 'hello' — no hardware required
Three commands away from a working integration test. The same parsers work against the mock and against real silicon.
/03 — try it live
Plug something in. This page can read it.
WebSerial lets the browser open a USB-CDC port directly. Connect an Arduino, an FTDI cable, or any serial device — frames stream straight into the console below. Don't have hardware handy? Run the mock instead — same parser pipeline, no wire.
Heads up: WebSerial isn't supported in this browser (Safari and Firefox don't ship it yet). The mock stream below works everywhere and uses the same parser pipeline you'd run against a real port — no hardware required.
— waiting for bytes —
/04 — the matrix
Twenty-one packages. Take what you need.
serialpilot
The meta package. Sensible defaults, all parsers re-exported, autodetected native bindings.
Bindings
@serialpilot/bindings-cpp
N-API native bindings, with prebuilds.
@serialpilot/bindings-interface
TypeScript surface for custom bindings.
@serialpilot/binding-mock
In-memory port for unit tests.
Interfaces & helpers
@serialpilot/stream
Node.js Stream wrapper around any binding.
@serialpilot/reconnect
Survive cable yanks and device resets.
@serialpilot/command-queue
Request/response over half-duplex links.
CLI
@serialpilot/list
serialpilot-list — enumerate ports.
@serialpilot/terminal
serialpilot-terminal — interactive console.
@serialpilot/repl
serialpilot-repl — scriptable Node REPL.
Parsers
- parser-byte-lengthfixed-size frames
- parser-cctalkccTalk validators
- parser-delimitersplit on byte sequence
- parser-inter-byte-timeoutquiescence framing
- parser-packet-lengthlength-prefixed packets
- parser-readlineline-by-line text
- parser-readywait for a sentinel
- parser-regexsplit on a pattern
- parser-slip-encoderRFC 1055 SLIP framing
- parser-spacepacketCCSDS Space Packet
- parser-start-endSTX/ETX-style frames
/05 — deployment roster
One toolkit. A thousand wires.
-
R/01 Robotics bench → sky Powers NodeBots.
The bridge between your JavaScript and the firmware on thousands of devices — from an Arduino on the bench to a swarm of drones overhead. Same stream, same parsers, same shape.
-
R/02 Consumer counter → cartridge From kitchen counters to game cartridges.
Pancake-printing arms. Hallway IoT widgets. Homebrew handhelds. Pair with Electron and the road from breadboard to shipped app stays one Node process wide.
-
R/03 Commercial subsea → ICU Underwater, underground, under audit.
Subsea sensors. Cargo drones. ATMs at three a.m. Forklift telematics. Bedside monitors. SerialPilot wears its MIT licence into rooms that don't usually let open source in — and patches flow back.
Plug something in.
See what it says.
SerialPilot is built & maintained by one person. If it saves you a weekend, buy me a coffee ☕