diff --git a/docs/BaseBinding.html b/docs/BaseBinding.html index 368b50983..ad812b731 100644 --- a/docs/BaseBinding.html +++ b/docs/BaseBinding.html @@ -2383,7 +2383,7 @@
Returns:

diff --git a/docs/ByteLengthParser.html b/docs/ByteLengthParser.html index 1937ac605..c70c3e494 100644 --- a/docs/ByteLengthParser.html +++ b/docs/ByteLengthParser.html @@ -69,7 +69,7 @@

new B
Source:
@@ -118,14 +118,12 @@

new B

Example
-
To use the `ByteLength` parser:
-```js
+    
// 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
-```
+parser.on('data', console.log); // will have 8 bytes per data event
@@ -285,7 +283,7 @@

Extends


diff --git a/docs/CCTalkParser.html b/docs/CCTalkParser.html index 4dc30ec6b..146abc58c 100644 --- a/docs/CCTalkParser.html +++ b/docs/CCTalkParser.html @@ -69,7 +69,7 @@

new CCTal
Source:
@@ -118,14 +118,12 @@

new CCTal

Example
-
CCTalk Messages are emitted as buffers.
-```js
+    
// CCTalk Messages are emitted as buffers.
 const SerialPort = require('serialport');
 const CCTalk = SerialPort.parsers.CCTalk;
 const port = new SerialPort('/dev/ttyUSB0');
 const parser = port.pipe(new CCtalk());
-parser.on('data', console.log);
-```
+parser.on('data', console.log);
@@ -187,7 +185,7 @@

Extends


diff --git a/docs/DelimiterParser.html b/docs/DelimiterParser.html index e7612ca14..1dfdc1353 100644 --- a/docs/DelimiterParser.html +++ b/docs/DelimiterParser.html @@ -69,7 +69,7 @@

new De
Source:
@@ -118,14 +118,12 @@

new De

Example
-
To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes:
-```js
+    
// To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes:
 const SerialPort = require('serialport');
 const Delimiter = SerialPort.parsers.Delimiter;
 const port = new SerialPort('/dev/tty-usbserial1');
-const parser = port.pipe(new Delimiter({ delimiter: Buffer.from('EOL') }));
-parser.on('data', console.log);
-```
+const parser = port.pipe(new Delimiter({ delimiter: '\n' })); +parser.on('data', console.log);
@@ -187,7 +185,7 @@

Extends


diff --git a/docs/Poller.html b/docs/Poller.html index a71de8163..bd941d870 100644 --- a/docs/Poller.html +++ b/docs/Poller.html @@ -576,7 +576,7 @@
Returns:

diff --git a/docs/ReadLineParser.html b/docs/ReadLineParser.html index df3b16a34..421502ec2 100644 --- a/docs/ReadLineParser.html +++ b/docs/ReadLineParser.html @@ -43,7 +43,8 @@

ReadLineParser

-

A transform stream that emits data after a newline delimiter is received.

+

A transform stream that emits data after a newline delimiter is received.

+

To use the Readline parser, provide a delimiter (defaults to \n). Data is emitted as string controllable by the encoding option (defaults to utf8).

@@ -69,7 +70,7 @@

new Rea
Source:
@@ -118,14 +119,11 @@

new Rea

Example
-
To use the `Readline` parser, provide a delimiter (defaults to '\n'). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`).
-```js
-const SerialPort = require('serialport');
+    
const SerialPort = require('serialport');
 const Readline = SerialPort.parsers.Readline;
 const port = new SerialPort('/dev/tty-usbserial1');
 const parser = port.pipe(new Readline({ delimiter: '\r\n' }));
-parser.on('data', console.log);
-```
+parser.on('data', console.log);
@@ -187,7 +185,7 @@

Extends


diff --git a/docs/ReadyParser.html b/docs/ReadyParser.html index 6a7a0496b..4045eca3c 100644 --- a/docs/ReadyParser.html +++ b/docs/ReadyParser.html @@ -43,7 +43,8 @@

ReadyParser

-

A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events

+

A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events

+

To use the Ready parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through.

@@ -69,7 +70,7 @@

new ReadyP
Source:
@@ -118,15 +119,12 @@

new ReadyP

Example
-
To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through.
-```js
-const SerialPort = require('serialport');
+    
const SerialPort = require('serialport');
 const Ready = SerialPort.parsers.Ready;
 const port = new SerialPort('/dev/tty-usbserial1');
 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
-```
+parser.on('data', console.log); // all data after READY is received
@@ -292,7 +290,7 @@

Extends


diff --git a/docs/RegexParser.html b/docs/RegexParser.html index 05344f320..56e1d0e78 100644 --- a/docs/RegexParser.html +++ b/docs/RegexParser.html @@ -43,7 +43,8 @@

RegexParser

-

A transform stream that uses a regular expression to split the incoming text upon.

+

A transform stream that uses a regular expression to split the incoming text upon.

+

To use the Regex parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the encoding option (defaults to utf8).

@@ -69,7 +70,7 @@

new RegexP
Source:
@@ -118,14 +119,11 @@

new RegexP

Example
-
To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`).
-```js
-const SerialPort = require('serialport');
+    
const SerialPort = require('serialport');
 const Regex = SerialPort.parsers.Regex;
 const port = new SerialPort('/dev/tty-usbserial1');
 const parser = port.pipe(new Regex({ regex: /[\r\n]+/ }));
-parser.on('data', console.log);
-```
+parser.on('data', console.log);
@@ -187,7 +185,7 @@

Extends


diff --git a/docs/SerialPort.html b/docs/SerialPort.html index fa2868c8f..b9e1a908b 100644 --- a/docs/SerialPort.html +++ b/docs/SerialPort.html @@ -2981,7 +2981,7 @@
Returns:

diff --git a/docs/bindings_base.js.html b/docs/bindings_base.js.html index a59a6e376..94b10cbe7 100644 --- a/docs/bindings_base.js.html +++ b/docs/bindings_base.js.html @@ -280,7 +280,7 @@

bindings/base.js


diff --git a/docs/bindings_poller.js.html b/docs/bindings_poller.js.html index 81a5505de..94cbfb884 100644 --- a/docs/bindings_poller.js.html +++ b/docs/bindings_poller.js.html @@ -151,7 +151,7 @@

bindings/poller.js


diff --git a/docs/global.html b/docs/global.html index a83adcf3e..8d2103076 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2027,7 +2027,7 @@

open


diff --git a/docs/index.html b/docs/index.html index dd26ff110..8aa335aca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -465,7 +465,7 @@

Serial Port List

serialport-list will list all available

diff --git a/docs/index.js.html b/docs/index.js.html index 02b58dc00..8660eaa41 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -65,7 +65,7 @@

index.js


diff --git a/docs/parsers_byte-length.js.html b/docs/parsers_byte-length.js.html index 9a680ea2e..b58164c36 100644 --- a/docs/parsers_byte-length.js.html +++ b/docs/parsers_byte-length.js.html @@ -47,14 +47,12 @@

parsers/byte-length.js

* @param {Object} options parser options object * @param {Number} options.length the number of bytes on each data event * @example -To use the `ByteLength` parser: -```js +// 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 -``` */ class ByteLengthParser extends Transform { constructor(options) { @@ -109,7 +107,7 @@

parsers/byte-length.js


diff --git a/docs/parsers_cctalk.js.html b/docs/parsers_cctalk.js.html index 10fcb1cb6..82a7a3695 100644 --- a/docs/parsers_cctalk.js.html +++ b/docs/parsers_cctalk.js.html @@ -44,14 +44,12 @@

parsers/cctalk.js

* Parses the CCTalk protocol * @extends Transform * @example -CCTalk Messages are emitted as buffers. -```js +// CCTalk Messages are emitted as buffers. const SerialPort = require('serialport'); const CCTalk = SerialPort.parsers.CCTalk; const port = new SerialPort('/dev/ttyUSB0'); const parser = port.pipe(new CCtalk()); parser.on('data', console.log); -``` */ class CCTalkParser extends Transform { constructor() { @@ -94,7 +92,7 @@

parsers/cctalk.js


diff --git a/docs/parsers_delimiter.js.html b/docs/parsers_delimiter.js.html index b2ba81205..c889782b7 100644 --- a/docs/parsers_delimiter.js.html +++ b/docs/parsers_delimiter.js.html @@ -44,14 +44,12 @@

parsers/delimiter.js

* A transform stream that emits data each time a byte sequence is received. * @extends Transform * @example -To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes: -```js +// To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes: const SerialPort = require('serialport'); const Delimiter = SerialPort.parsers.Delimiter; const port = new SerialPort('/dev/tty-usbserial1'); -const parser = port.pipe(new Delimiter({ delimiter: Buffer.from('EOL') })); +const parser = port.pipe(new Delimiter({ delimiter: '\n' })); parser.on('data', console.log); -``` */ class DelimiterParser extends Transform { constructor(options) { @@ -102,7 +100,7 @@

parsers/delimiter.js


diff --git a/docs/parsers_index.js.html b/docs/parsers_index.js.html index 3bf95e112..7d5d75a00 100644 --- a/docs/parsers_index.js.html +++ b/docs/parsers_index.js.html @@ -86,7 +86,7 @@

parsers/index.js


diff --git a/docs/parsers_readline.js.html b/docs/parsers_readline.js.html index 696741178..6cbc3dbf3 100644 --- a/docs/parsers_readline.js.html +++ b/docs/parsers_readline.js.html @@ -42,16 +42,15 @@

parsers/readline.js

const DelimiterParser = require('./delimiter'); /** * A transform stream that emits data after a newline delimiter is received. + * + * To use the `Readline` parser, provide a delimiter (defaults to `\n`). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). * @extends DelimiterParser * @example -To use the `Readline` parser, provide a delimiter (defaults to '\n'). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). -```js const SerialPort = require('serialport'); const Readline = SerialPort.parsers.Readline; const port = new SerialPort('/dev/tty-usbserial1'); const parser = port.pipe(new Readline({ delimiter: '\r\n' })); parser.on('data', console.log); -``` */ class ReadLineParser extends DelimiterParser { constructor(options) { @@ -81,7 +80,7 @@

parsers/readline.js


diff --git a/docs/parsers_ready.js.html b/docs/parsers_ready.js.html index 0af3d556c..773240f05 100644 --- a/docs/parsers_ready.js.html +++ b/docs/parsers_ready.js.html @@ -42,17 +42,16 @@

parsers/ready.js

const Transform = require('stream').Transform; /** * A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events + * + * To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through. * @extends Transform * @example -To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through. -```js const SerialPort = require('serialport'); const Ready = SerialPort.parsers.Ready; const port = new SerialPort('/dev/tty-usbserial1'); 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 { /** @@ -116,7 +115,7 @@

parsers/ready.js


diff --git a/docs/parsers_regex.js.html b/docs/parsers_regex.js.html index a3391f78c..f6454aec4 100644 --- a/docs/parsers_regex.js.html +++ b/docs/parsers_regex.js.html @@ -41,17 +41,15 @@

parsers/regex.js

const Transform = require('stream').Transform; /** * A transform stream that uses a regular expression to split the incoming text upon. + * + * To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). * @extends Transform * @example -To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). -```js const SerialPort = require('serialport'); const Regex = SerialPort.parsers.Regex; const port = new SerialPort('/dev/tty-usbserial1'); const parser = port.pipe(new Regex({ regex: /[\r\n]+/ })); parser.on('data', console.log); -``` - */ class RegexParser extends Transform { constructor(options) { @@ -103,7 +101,7 @@

parsers/regex.js


diff --git a/docs/serialport.js.html b/docs/serialport.js.html index 008d66518..32065b77d 100644 --- a/docs/serialport.js.html +++ b/docs/serialport.js.html @@ -684,7 +684,7 @@

serialport.js


diff --git a/lib/parsers/byte-length.js b/lib/parsers/byte-length.js index cd7cb5017..91271bec4 100644 --- a/lib/parsers/byte-length.js +++ b/lib/parsers/byte-length.js @@ -8,14 +8,12 @@ const Transform = require('stream').Transform; * @param {Object} options parser options object * @param {Number} options.length the number of bytes on each data event * @example -To use the `ByteLength` parser: -```js +// 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 -``` */ class ByteLengthParser extends Transform { constructor(options) { diff --git a/lib/parsers/cctalk.js b/lib/parsers/cctalk.js index e895f8687..de03a6c96 100644 --- a/lib/parsers/cctalk.js +++ b/lib/parsers/cctalk.js @@ -5,14 +5,12 @@ const Buffer = require('safe-buffer').Buffer; * Parses the CCTalk protocol * @extends Transform * @example -CCTalk Messages are emitted as buffers. -```js +// CCTalk Messages are emitted as buffers. const SerialPort = require('serialport'); const CCTalk = SerialPort.parsers.CCTalk; const port = new SerialPort('/dev/ttyUSB0'); const parser = port.pipe(new CCtalk()); parser.on('data', console.log); -``` */ class CCTalkParser extends Transform { constructor() { diff --git a/lib/parsers/delimiter.js b/lib/parsers/delimiter.js index f9b74757a..5653e7e20 100644 --- a/lib/parsers/delimiter.js +++ b/lib/parsers/delimiter.js @@ -5,14 +5,12 @@ const Transform = require('stream').Transform; * A transform stream that emits data each time a byte sequence is received. * @extends Transform * @example -To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes: -```js +// To use the `Delimiter` parser, provide a delimiter as a string, buffer, or array of bytes: const SerialPort = require('serialport'); const Delimiter = SerialPort.parsers.Delimiter; const port = new SerialPort('/dev/tty-usbserial1'); -const parser = port.pipe(new Delimiter({ delimiter: Buffer.from('EOL') })); +const parser = port.pipe(new Delimiter({ delimiter: '\n' })); parser.on('data', console.log); -``` */ class DelimiterParser extends Transform { constructor(options) { diff --git a/lib/parsers/readline.js b/lib/parsers/readline.js index 348437199..c463f4b64 100644 --- a/lib/parsers/readline.js +++ b/lib/parsers/readline.js @@ -3,16 +3,15 @@ const Buffer = require('safe-buffer').Buffer; const DelimiterParser = require('./delimiter'); /** * A transform stream that emits data after a newline delimiter is received. + * + * To use the `Readline` parser, provide a delimiter (defaults to `\n`). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). * @extends DelimiterParser * @example -To use the `Readline` parser, provide a delimiter (defaults to '\n'). Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). -```js const SerialPort = require('serialport'); const Readline = SerialPort.parsers.Readline; const port = new SerialPort('/dev/tty-usbserial1'); const parser = port.pipe(new Readline({ delimiter: '\r\n' })); parser.on('data', console.log); -``` */ class ReadLineParser extends DelimiterParser { constructor(options) { diff --git a/lib/parsers/ready.js b/lib/parsers/ready.js index c953ba7b5..e3495545d 100644 --- a/lib/parsers/ready.js +++ b/lib/parsers/ready.js @@ -3,17 +3,16 @@ const Buffer = require('safe-buffer').Buffer; const Transform = require('stream').Transform; /** * A transform stream that waits for a sequence of "ready" bytes before emitting a ready event and emitting data events + * + * To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through. * @extends Transform * @example -To use the `Ready` parser provide a byte start sequence. After the bytes have been received a ready event is fired and data events are passed through. -```js const SerialPort = require('serialport'); const Ready = SerialPort.parsers.Ready; const port = new SerialPort('/dev/tty-usbserial1'); 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 { /** diff --git a/lib/parsers/regex.js b/lib/parsers/regex.js index fa4031b64..977d04b78 100644 --- a/lib/parsers/regex.js +++ b/lib/parsers/regex.js @@ -2,17 +2,15 @@ const Transform = require('stream').Transform; /** * A transform stream that uses a regular expression to split the incoming text upon. + * + * To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). * @extends Transform * @example -To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`). -```js const SerialPort = require('serialport'); const Regex = SerialPort.parsers.Regex; const port = new SerialPort('/dev/tty-usbserial1'); const parser = port.pipe(new Regex({ regex: /[\r\n]+/ })); parser.on('data', console.log); -``` - */ class RegexParser extends Transform { constructor(options) {