ByteLengthParser

ByteLengthParser

A transform stream that emits data as a buffer after a specific number of bytes are received.

Constructor

new ByteLengthParser(options)

Source:
Example
To use the `ByteLength` parser:
```js
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
Properties
Name Type Description
length Number

the number of bytes on each data event

Extends

  • Transform