Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@serialport/parser-readline
Advanced tools
See our api docs https://node-serialport.github.io/parsers/ReadLineParser.html
@serialport/parser-readline is a parser for the serialport library that reads data from a serial port and splits it into lines based on a delimiter. It is useful for applications that need to process data line-by-line from serial devices.
Basic Line Parsing
This feature allows you to read data from a serial port and split it into lines based on a specified delimiter. In this example, the delimiter is set to '\r\n'.
const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const port = new SerialPort('/dev/tty-usbserial1', { baudRate: 9600 });
const parser = port.pipe(new Readline({ delimiter: '\r\n' }));
parser.on('data', line => {
console.log(`Received line: ${line}`);
});
Custom Delimiter
This feature allows you to specify a custom delimiter for splitting the data into lines. In this example, the delimiter is set to ';'.
const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const port = new SerialPort('/dev/tty-usbserial1', { baudRate: 9600 });
const parser = port.pipe(new Readline({ delimiter: ';' }));
parser.on('data', line => {
console.log(`Received line: ${line}`);
});
Handling Errors
This feature demonstrates how to handle errors that may occur while reading data from the serial port. The error event is listened to on the port object.
const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const port = new SerialPort('/dev/tty-usbserial1', { baudRate: 9600 });
const parser = port.pipe(new Readline({ delimiter: '\r\n' }));
parser.on('data', line => {
console.log(`Received line: ${line}`);
});
port.on('error', err => {
console.error('Error: ', err.message);
});
See our api docs https://node-serialport.github.io/parsers/ReadLineParser.html
Version 1.0.4
FAQs
See our api docs See our api docs https://serialport.io/docs/api-parser-readline
The npm package @serialport/parser-readline receives a total of 99,628 weekly downloads. As such, @serialport/parser-readline popularity was classified as popular.
We found that @serialport/parser-readline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.