Skip to main content

Class: CSVReader

CSV parser

Extends

Constructors

new CSVReader()

new CSVReader(concatRows?, colJoiner?, rowJoiner?, config?): CSVReader

Constructs a new instance of the class.

Parameters

concatRows?: boolean

Whether to concatenate all rows into one document.If set to False, a Document will be created for each row. True by default.

colJoiner?: string

Separator to use for joining cols per row. Set to ", " by default.

rowJoiner?: string

Separator to use for joining each row.Only used when concat_rows=True.Set to "\n" by default.

config?: Options

Returns

CSVReader

Overrides

FileReader.constructor

Defined in

packages/readers/csv/dist/index.d.ts:19

Properties

parse()

static parse: (input, options?, callback?) => Parser(input, callback?) => Parser(options?, callback?) => Parser(callback?) => Parser

Parameters

input: string | Buffer<ArrayBufferLike>

options?: Options

callback?: Callback

Returns

Parser

Parameters

input: string | Buffer<ArrayBufferLike>

callback?: Callback

Returns

Parser

Parameters

options?: Options

callback?: Callback

Returns

Parser

Parameters

callback?: Callback

Returns

Parser

Defined in

packages/readers/csv/dist/index.d.ts:8

Methods

loadData()

loadData(filePath): Promise<Document<Metadata>[]>

Parameters

filePath: string

Returns

Promise<Document<Metadata>[]>

Inherited from

FileReader.loadData

Defined in

packages/core/schema/dist/index.d.ts:188


loadDataAsContent()

loadDataAsContent(fileContent): Promise<Document<Metadata>[]>

Loads data from csv files

Parameters

fileContent: Uint8Array<ArrayBufferLike>

The content of the file.

Returns

Promise<Document<Metadata>[]>

An array of Documents.

Overrides

FileReader.loadDataAsContent

Defined in

packages/readers/csv/dist/index.d.ts:25


addMetaData()

static addMetaData(filePath): (doc, index) => void

Parameters

filePath: string

Returns

Function

Parameters

doc: BaseNode<Metadata>

index: number

Returns

void

Inherited from

FileReader.addMetaData

Defined in

packages/core/schema/dist/index.d.ts:189