How can I return the data (csvData) from the reader.onload function. I want that the data will return from readCsv function:
async readCSV(event) {
const reader = new FileReader();
reader.readAsText(event.target.files[0]);
var csvToJson;
csvToJson = reader.onload = async () => {
const text = reader.result;
const csvData = await this.csvJSON(text);
return csvData;
};
return csvToJson;
}