Promise.all 错误
作者: jzzqwhw创建于 2024年8月2日更新于 2026年9月10日
标签Help wantedRelated to: Code qualityBug: Code provided to reproducedGood first issue
(async () => {
async function fun1() {
let f1 = "D:\a1.xlsx";
const res1 = await alasql.promise(select * from xlsx(?) limit 100000, [f1]);
return res1;
}
async function fun2() {
let f2 = "D:\\a2.xlsx";
const res2 = await alasql.promise(`select * from xlsx(?) limit 100001`, [f2]);
return res2;
}
try {
const orderData = await Promise.all([fun1(), fun2()]);
console.log(orderData);
} catch (error) {
console.error(error);
} finally {
console.log('end');
}
})();
我有一个问题,我创建了两个异步函数,fun1 和 fun2,并希望使用 Promise.all 批量执行它们,将参数 f1 和 f2 传递给 xlsx(?) 占位符。
内容来源: AlaSQL/alasql