when we console.log(restaurantdata) inside the .on('end') function return log but outside function log cant give value return undefined.
var restaurantdata=[];
fs.createReadStream('restaurantsa9126b3.csv')
.pipe(csv())
.on('data', (data) => restaurantdata.push(data))
.on('end', () => {
return restaurantdata;
})
console.log(restaurantdata);
yield this.render('home',{
restaurantdata:restaurantdata,
});