Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev Guide
Dev GuideUser GuidesGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

OCP App SDK


OCP App SDK / CsvStream

Class: CsvStream<T>

Defined in: src/util/CsvStream.ts:19

Superclass of stream file reader with the main
logic involve in processing a file line by line

Extends

Type Parameters

T

T

Constructors

Constructor

new CsvStream<T>(streamBuilder, rowProcessor, options): CsvStream<T>

Defined in: src/util/CsvStream.ts:58

Parameters

streamBuilder

FileReadableStreamBuilder

rowProcessor

CsvRowProcessor<T>

options

Options = {}

Returns

CsvStream<T>

Overrides

FileStream.constructor

Accessors

isFinished

Get Signature

get isFinished(): boolean

Defined in: src/util/FileStream.ts:44

Returns

boolean

Inherited from

FileStream.isFinished

Methods

fastforward()

fastforward(target): Promise<null | string>

Defined in: src/util/FileStream.ts:48

Parameters

target

string

Returns

Promise<null | string>

Inherited from

FileStream.fastforward


processSome()

processSome(): Promise<null | string>

Defined in: src/util/FileStream.ts:53

Returns

Promise<null | string>

Inherited from

FileStream.processSome


fromStream()

static fromStream<T>(stream, processor, options): CsvStream<T>

Defined in: src/util/CsvStream.ts:27

Build a CsvStream from an existing ReadableStream.

Type Parameters

T

T

Parameters

stream

ReadableStream

source stream for the csv data

processor

CsvRowProcessor<T>

the row processor

options

Options = {}

options to provide the underlying parser,
see https://github.com/mafintosh/csv-parser#csvoptions--headers

Returns

CsvStream<T>


fromUrl()

static fromUrl<T>(url, processor, options): CsvStream<T>

Defined in: src/util/CsvStream.ts:42

Build a CsvStream that reads from a web resource.

Type Parameters

T

T

Parameters

url

string

source url for the csv data

processor

CsvRowProcessor<T>

the row processor

options

Options = {}

options to provide the underlying parser,
see https://github.com/mafintosh/csv-parser#csvoptions--headers

Returns

CsvStream<T>