@serialpilot/parser-delimiter
v1.0.1
Published
A transform stream that emits data each time a delimiter byte sequence is received.
Maintainers
Readme
A Transform stream that emits data each time a delimiter is received in the stream.
npm install @serialpilot/parser-delimiterUsage
const { SerialPilot, DelimiterParser } = require('serialpilot')
const port = new SerialPilot({ path: '/dev/ttyUSB0', baudRate: 9600 })
const parser = port.pipe(new DelimiterParser({ delimiter: '\n' }))
parser.on('data', console.log)API
new DelimiterParser({ delimiter, includeDelimiter })
| Option | Type | Default | Description |
| ------------------ | ------------------------------- | ------- | -------------------------------------------------------- |
| delimiter | string \| Buffer \| number[] | — | Required. Bytes that delimit messages (length >= 1). |
| includeDelimiter | boolean | false | Whether emitted chunks include the delimiter. |
See the SerialPilot README for the full set of parsers.
