Npm module "csv-to-array" does not read entire CSV file given as input

113 Views Asked by At

I am trying to read CSV file in JavaScript using npm module csv-to-array into an array. I expect the rows_in_csv array to hold all rows (count > 1000) of CSV. But it holds data for only first 507 rows. This is the issue.

let fs = require('fs');
let cwd = __dirname;
let file_path = cwd.concat("/farsi_localization_data.csv");

require("csv-to-array")({
  file: file_path,
  columns: ["Complete key", "", "English Value", "Hindi Value"]
}, function (err, rows_in_csv) {
  let row_count = rows_in_csv.length;

  console.log(`number of rows in CSV is ${row_count}`);
});

Please tell why this would be happening.

0

There are 0 best solutions below