Constructor
new ByteLengthParser(options)
- Source:
Example
// To use the `ByteLength` parser:
const SerialPort = require('serialport');
const ByteLength = SerialPort.parsers.ByteLength
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
Parameters:
| Name |
Type |
Description |
options |
Object
|
parser options object
Properties
| Name |
Type |
Description |
length |
Number
|
the number of bytes on each data event |
|