Skip to content

Commit

Permalink
docs(readyParser): correct the required parameters (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
reconbot authored Nov 5, 2017
1 parent f8f3ce5 commit dcd256d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/parsers/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ To use the `Ready` parser provide a byte start sequence. After the bytes have be
const SerialPort = require('serialport');
const Ready = SerialPort.parsers.Ready;
const port = new SerialPort('/dev/tty-usbserial1');
const parser = port.pipe(new Ready({ data: 'READY' }));
const parser = port.pipe(new Ready({ delimiter: 'READY' }));
parser.on('ready', () => console.log('the ready byte sequence has been received'))
parser.on('data', console.log); // all data after READY is received
```
*/
class ReadyParser extends Transform {
/**
*
* @param {object} options
* @param {string|Buffer|array} options.delimiter
*/
constructor(options) {
options = options || {};
if (options.delimiter === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion test/manual-testing/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const SerialPort = require('../../');
const ByteLength = SerialPort.parsers.ByteLength;
const exec = require('child_process').exec;

// Serial receiver device
// Serial receiver device
const port = process.env.TEST_PORT_RX;
// Expected number of bytes to receive (should make `size` in drain.js)
const expected = 512;
Expand Down

0 comments on commit dcd256d

Please sign in to comment.