Class: Parser

gpf.stream.csv. Parser


new Parser( [parserOptions])

CSV Parser

Parses the incoming stream by considering each write as a separate line. It is recommended to use the gpf.stream.LineAdapter class in between the incoming stream and the CSV parser.

Generates objects where properties are matching header columns and values are string extracted from record lines.

Parameters:
Name Type Argument Description
parserOptions gpf.typedef.csvParserOptions <optional>

Parser options

Since:
  • 0.2.3
Implements:

Extends

Methods


<protected> _appendToReadBuffer(data)

Adds data to the read buffer

Parameters:
Name Type Argument Description
data * <repeatable>

Data to write

Since:
  • 0.2.3
Inherited From:
Returns:
Self reference to allow chaining
Type
gpf.stream.csv.Parser

<protected> _completeReadBuffer()

Ends the read without any error

Since:
  • 0.2.3
Inherited From:

<protected> _setReadError(reason)

Ends the read with an error

Parameters:
Name Type Description
reason *

Rejection reason

Since:
  • 0.2.3
Inherited From:

flush()

Request buffered data to be flushed. It does not need to wait for subsequent reads.

Since:
  • 0.2.3
Implements:
Returns:

Resolved when ready

Type
Promise

read(output)

Read all data from the underlying source. Chunk of data is passed to the gpf.interfaces.IWritableStream.

Parameters:
Name Type Description
output gpf.interfaces.IWritableStream

Stream that receives chunk of data

Since:
  • 0.2.3
Inherited From:
Implements:
Returns:

Resolved when the stream has ended

Type
Promise

write(data)

Write data to the underlying destination

Parameters:
Name Type Description
data *

Data to write

Since:
  • 0.2.3
Implements:
Returns:

Resolved when ready

Type
Promise