Dev Guide
Dev GuideUser GuidesLegal TermsGitHubDevCommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

OCP App SDK / CsvStream

CsvStream<T>

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

Type parameters

  • T

Hierarchy

Index

Constructors

Accessors

Methods

Constructors

constructor()

Signature

new CsvStream<T>(streamBuilder: FileReadableStreamBuilder, rowProcessor: CsvRowProcessor<T>, options: Options = {}): CsvStream<T>;

Type parameters

  • T

Parameters

NameType
streamBuilderFileReadableStreamBuilder
rowProcessorCsvRowProcessor<T>
optionsOptions

Returns

CsvStream<T>

Overrides: FileStream.constructor

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

Accessors

isFinished

Signature

isFinished(): boolean;

Returns

boolean

Inherited from: FileStream.isFinished

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

Inherited from: FileStream.isFinished

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

Methods

fastforward()

Signature

fastforward(target: string): Promise<null | string>;

Parameters

NameType
targetstring

Returns

Promise<null | string>

Inherited from: FileStream.fastforward

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

processSome()

Signature

processSome(): Promise<null | string>;

Returns

Promise<null | string>

Inherited from: FileStream.processSome

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

fromStream()

Build a CsvStream from an existing ReadableStream.

Signature

Static fromStream<T>(stream: ReadableStream, processor: CsvRowProcessor<T>, options: Options = {}): CsvStream<T>;

Type parameters

  • T

Parameters

NameTypeDescription
streamReadableStreamsource stream for the csv data
processorCsvRowProcessor<T>the row processor
optionsOptionsoptions to provide the underlying parser,
see https://github.com/mafintosh/csv-parser#csvoptions--headers

Returns

CsvStream<T>

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

fromUrl()

Build a CsvStream that reads from a web resource.

Signature

Static fromUrl<T>(url: string, processor: CsvRowProcessor<T>, options: Options = {}): CsvStream<T>;

Type parameters

  • T

Parameters

NameTypeDescription
urlstringsource url for the csv data
processorCsvRowProcessor<T>the row processor
optionsOptionsoptions to provide the underlying parser,
see https://github.com/mafintosh/csv-parser#csvoptions--headers

Returns

CsvStream<T>

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