documentation index
Read the manual. Or skim it.
Reference, recipes, and a getting-started guide. Each page is a single focused topic — install once, then dip in as you need each piece.
/01 — Start here
01 pages/02 — Reference
06 pages- 01 Core API The SerialPilot class is a Node.js Duplex stream — read it, write to it, pipe it. Everything below is exposed from the top-level serialpilot package; subpackages mirror the same names if you prefer to install à la carte.
- 02 Parsers Every parser is a Node Transform stream. You pipe a port into one, listen for data, and you get framed messages instead of a chaotic byte stream. Pick the parser that matches your protocol's framing strategy.
- 03 Testing & mocking Hardware lies. Hardware is also slow, expensive, and not in CI. @serialpilot/binding-mock gives you a virtual port that behaves like the real one, so the same code paths — parsers, error handlers, reconnect logic — run in unit tests too.
- 04 CLI tools Three small binaries — list, terminal, repl — for the things you'd otherwise script ad hoc. Install them per-project with npm i or globally with npm i -g; they all use the same N-API bindings as the library.
- 05 Errors & reliability Every error SerialPilot throws is a strongly-typed subclass of SerialPilotError with a stable code, a human message, and an actionable advice string. You can match on the class, on the code, or on both.
- 06 Package matrix Twenty-one published packages, all version 1.0.0, all under the @serialpilot scope (with the exception of the meta package, which is just serialpilot). Install the meta package for the common case; cherry-pick when bundle size matters.
/03 — Recipes
06 pages- 01 Arduino Find the board, open the port, wait for the boot banner, then talk. The full pattern in three short steps.
- 02 Modbus RTU Modbus RTU is a half-duplex, master/slave protocol over RS-485 (or RS-232). The command queue handles the send-then-wait dance for you, including timeouts and retries — exactly what flaky industrial wiring demands.
- 03 Production reconnect Real devices come and go. They reboot mid-session, change USB paths between hosts, and survive fewer cable cycles than spec sheets claim. @serialpilot/reconnect wraps your port and brings it back when the world wobbles.
- 04 Error handling SerialPilot's errors come with a stable code, a human message, and an actionable advice string. Treat them as data, not as flammable strings — your operations team will thank you.
- 05 Electron Native modules and Electron get along just fine — provided you put them in the right process and rebuild against Electron's V8. Two rules and three gotchas.
- 06 Docker Containers don't see USB devices unless you let them. Pass the device through with --device, fingerprint with udev rules, and find by VID/PID — paths are not your friend.