尝试调用读取并返回csv数据的函数。我知道流程是aysnch,因为我得到的输出是:
数据=未定义 CSV阅读完毕
找不到解决方法。
export class ReadData {
public getData = () => {
let actualData:any = [];
csv
.fromStream(stream, {headers : ["Name","Date","Info","Type"]})
.on("data", function(data){
//console.log(data);
return data;
})
.on("end", function(){
console.log("csv reading done");
});
}
}
function inputs() {
let inputs = new ReadData().getData();
console.log("Data = " + JSON.stringify(inputs));
};