const data_ = () => {
let array = []
fs.createReadStream('./files/treinamento.csv')
.pipe(csv())
.on('data', (data) => {
array.push(data)
})
.on('end', () => {
console.log(array)
})
}
Using console.log I get return with the values I want, but replacing the console with return the function returns me an empty array. Could someone give me a solution?