mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
882 B
882 B
| id | title |
|---|---|
| api-parser-inter-byte-timeout | InterByteTimeout Parser |
new InterByteTimeout(options)
Emits data if there is a pause between packets for the specified amount of time.
A transform stream that emits data as a buffer after not recieving any bytes for the specified amount of time.
Arguments
options.interval: numberthe period of silence in milliseconds after which data is emitedoptions.maxBufferSize: numberthe maximum number of bytes after which data will be emited. Defaults to 65536.
Example
const SerialPort = require('serialport')
const InterByteTimeout = require('@serialport/parser-inter-byte-timeout')
const port = new SerialPort('/dev/tty-usbserial1')
const parser = port.pipe(new InterByteTimeout({interval: 30}))
parser.on('data', console.log) // will emit data if there is a pause between packets of at least 30ms