The problem is not with fileHash
, it's with its caller.(问题不fileHash
,而是它的调用者。)
This(这个)
function external() {
const foo = await fileHash(...someArgs);
}
Won't work.(不行) This(这个)
async function external() {
const foo = await fileHash(...someArgs);
}
will.(将。)
(OTOH, fileHash
itself doesn't need to be async to be await
ed. You can even await 2 + 2
).((OTOH, fileHash
本身不需要异步即可await
。您甚至可以await 2 + 2
)。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…