Reading a CSV file, I can't return the data read. console.log(data) contains what I need, but it's not returning data (e.g. when calling the readCSV function):
export default function readCSV(filename) {
   let parser = parse({columns: true, trim: true, skip_empty_lines: true}, function(err, data){
       console.log(data);
       return data;
    });
    fs.createReadStream(__dirname + '/' + filename).pipe(parser);
    return parser;
}
This gives me the parser instance and not the data - tried many variations of it. How do I return data? What am I missing as a concept in JS?
I'm using the node-csv-parse lib.
 
    