Currently in my coding project using C#, I have incorporated the .NET package File.ReadLines(). Is there a way to replicate this functionality in JavaScript?
var csvArray = File.ReadLines(filePath).Select(x => x.Split(',')).ToArray();
I am aware that LINQ Select can be utilized in Javascript as well. My focus at the moment is on parsing a CSV file. Below is the snippet of my JS code.
var fs = require('fs');
var csv = require('fast-csv');
var filepath = $('#appFilePathInput').value();
fs.createReadStream(filepath)
.pipe(csv())
.on('data', function(data){
//Should I implement the equivalent of LINQ Select and Split toArray here?
});
.on('data', function(data){
console.log('Read Finished');
});
The ultimate objective is to convert a local CSV file into an Array using pure JavaScript.
I would greatly appreciate any assistance in refining my current code, as I am new to writing code in JavaScript from scratch.
Thank you for your support!