UNPKG

@pujansrt/data-genie

Version:

High performant ETL engine written in TypeScript

28 lines (27 loc) 1.19 kB
import { DataReader, DataRecord } from '../core/interfaces'; /** * TSVReader class for reading data records from a Tab-Separated Values (TSV) file. * It uses the 'csv-parse' library, configured specifically for tab delimiters. */ export declare class TSVReader implements DataReader { private filePath; private hasFieldNamesInFirstRow; /** * Constructs a new TSVReader. * @param filePath The path to the TSV file. */ constructor(filePath: string); /** * Specifies whether the first row of the TSV file contains field names (headers). * If true, the yielded records will be objects with these field names as keys. * If false, records will be arrays or objects with numerical keys (e.g., {0: 'value1', 1: 'value2'}). * @param value True if the first row is a header, false otherwise. * @returns The current TSVReader instance for chaining. */ setFieldNamesInFirstRow(value: boolean): this; /** * Reads data records from the TSV file asynchronously, yielding each record as it's parsed. * @returns An AsyncIterableIterator of DataRecord objects. */ read(): AsyncIterableIterator<DataRecord>; }