I'm trying to work with the output of a papaparse CSV read using the following:
const file = fs.createReadStream('./data.csv');
let out;
Papa.parse(file, {
header: true,
dynamicTyping: true,
complete: (results) => {
console.log(results);
out = results.data;
},
});
The console.log
correctly log the results, but out
remains undefined... I feel like I'm doing it very similar to this answer... any help much appreciated
Note: although this seems very similar to this question, I actually do need to persist the data into global state (not going to go into detail here)