I am reading a CSV file using csv-parser npm module createReadStream.
export default async function main() {
const readstream = fs.createReadStream('src/working_file.csv');
stream.on('data', data => {
const val = await fun(param1, param2, param3);
});
fun(param1, param2, param3){
return true;
}
}
I have to call function fun with await but it is throwing me the error.await is only valid in async function. Can anyone help me how to fix this?