Constructor
new ByteLengthParser(options)
A transform stream that emits data as a buffer after a specific number of bytes are received. Runs in O(n) time.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | parser options object Properties
|
- Source:
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
Extends
- Transform