mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
637 B
637 B
| id | title |
|---|---|
| api-parser-byte-length | ByteLength Parser |
new ByteLength(options)
Emit data every number of bytes.
A transform stream that emits data as a buffer after a specific number of bytes are received. Runs in O(n) time.
Arguments
options.length: numberthe number of bytes to be emitted on each data event
Example
const SerialPort = require('serialport')
const ByteLength = require('@serialport/parser-byte-length')
const port = new SerialPort('/dev/tty-usbserial1')
const parser = port.pipe(new ByteLength({length: 8}))
parser.on('data', console.log) // will have 8 bytes per data event