CSVDoc

CSVDoc

This class is responsible for reading a CSV file, processing its content, and providing methods to access its data. It reads the file, processes the CSV content, and provides methods to get the file path, file content, column names, and perform aggregations on specific columns.

Constructor

new CSVDoc(filePath, separatoropt)

Description:
  • Setup the CSVDoc instance with the file path. methods to access its data. It reads the file, processes the CSV content, and provides methods to get the file path, file content, column names, and perform aggregations on specific columns.

Source:
Parameters:
Name Type Attributes Default Description
filePath string

The absolute path to the csv file

separator string <optional>
,

The separator of the CSV

Classes

CSVDoc

Methods

aggregateColumn(name) → {Aggregation}

Description:
  • Get the aggregation data for the given column.

Source:
Parameters:
Name Type Description
name string

The name of the column

Returns:

Returns the aggregation class for the column

Type
Aggregation

getColumns() → {Array}

Description:
  • Get the column name of the csv that is imported

Source:
Returns:

An array of column names

Type
Array

getFile() → {object}

Description:
  • Get the fs object of the file

Source:
Returns:

The fs.readFileSync() object of the file

Type
object

getFilePath() → {string}

Description:
  • Get the path of the file

Source:
Returns:

The string of the absolute file path

Type
string