@technoculture/safeserial
v0.1.3
Published
Guaranteed reliable serial communication for Node.js and Electron
Maintainers
Readme
SafeSerial for Node.js
Reliable serial messaging with CRC32, fragmentation, and ACK/Retry. Built for Electron and embedded workflows where silent corruption is unacceptable.
Install
npm install @technoculture/safeserialIf a prebuilt binary is not available for your platform, it will build from source on install.
Quickstart
import { DataBridge } from "@technoculture/safeserial";
const bridge = await DataBridge.open("/dev/ttyUSB0", { baudRate: 115200 });
bridge.on("data", (data) => {
console.log("Received:", data.toString());
});
await bridge.send("Hello, SafeSerial");
await bridge.close();Why SafeSerial
- Guaranteed delivery with ACK/Retry
- CRC32 corruption detection
- Automatic fragmentation and reassembly
- Resilient reconnect support
- Electron-friendly native bindings
API (Essentials)
DataBridge.open(port, options?)
Opens a serial port with reliable communication enabled.
port: device path (e.g./dev/ttyUSB0,COM3)options.baudRate: default115200
Returns: Promise<DataBridge>
bridge.send(data)
Sends data with guaranteed delivery.
data:Bufferorstring
Returns: Promise<void>
bridge.on("data", callback)
Subscribe to received data.
bridge.close()
Closes the serial port.
Build From Source
cd bindings/node
npm install
npm run buildLicense
MIT
