@serialpilot/parser-inter-byte-timeout
v1.0.1
Published
A transform stream that emits data when the wire goes quiet for N ms.
Downloads
9,531
Maintainers
Readme
A Transform stream that emits buffered data when no new bytes have been received for a configurable interval. Useful for protocols whose frames are delimited by silence rather than a byte sequence (Modbus RTU, ASCII commands without trailing newline, etc.).
npm install @serialpilot/parser-inter-byte-timeoutUsage
const { SerialPilot, InterByteTimeoutParser } = require('serialpilot')
const port = new SerialPilot({ path: '/dev/ttyUSB0', baudRate: 9600 })
const parser = port.pipe(new InterByteTimeoutParser({ interval: 30 }))
parser.on('data', console.log)API
new InterByteTimeoutParser({ interval, maxBufferSize })
| Option | Type | Default | Description |
| --------------- | ------ | ------- | ------------------------------------------------------------ |
| interval | number | — | Required. Milliseconds of silence before emitting (>= 1). |
| maxBufferSize | number | 65536 | Maximum bytes buffered before forcing emit. |
See the SerialPilot README for the full set of parsers.
