異步函數轉換成promise寫法promise
function getArrayData (pathFile) { return new Promise(function (result) { const fileStream = fs.createReadStream(pathFile); const allDatas = []; csv .fromStream(fileStream, { headers: true }) .on('data', (data) => { allDatas.push(data); }) .on('end', async () => { result(allDatas); }); }); }