Rust-backed serial ports for Node.js, with a SerialPort 13-compatible API.
- Parallel I/O through a dedicated, bounded Rust worker pool.
- Consistently lower p95 and p99 latency with a comparable median in recorded Linux ARM64 PTY runs. Measurements.
- Streams, parsers, bindings, and a pure-JavaScript mock in one package.
- No JavaScript runtime dependencies.
- Bounded read-ahead and explicit ownership of queued buffers.
One active port starts one I/O worker. More ports share up to four workers, which retire after their last port closes. Original SerialPort also uses native threads; this implementation separates serial I/O from Node's shared libuv worker pool.
Requires Node.js 20 or newer. Get the latest npm release:
npm install @dragonwork/node-serialport-rsimport {SerialPort, ReadlineParser} from '@dragonwork/node-serialport-rs';
const port = new SerialPort({path: '/dev/ttyUSB0', baudRate: 115200});
const lines = port.pipe(new ReadlineParser({delimiter: '\r\n'}));
port.on('error', error => console.error(error.message));
lines.on('data', line => console.log(line));
port.on('open', () => {
port.write('status\r\n', error => {
if (error) console.error(error.message);
});
});CommonJS works too: const {SerialPort} = require('@dragonwork/node-serialport-rs').
- Migrating from SerialPort
- Stream and binding API, options, and parsers
- Mock ports
- Architecture, memory ownership, and lifecycle
- Native build targets
- Development and checks
- Latency measurements
Thanks to the SerialPort maintainers and contributors. Its API and testing approach helped shape this project.
Copyright 2026 DragonWork. Apache-2.0. See NOTICE and third-party licenses.