there is a problem with the saver.getFileContent code. Check the return value of this method
the method after await must return promise. The estimated problem is that there is a problem with the return value of your saver.getFileContent method
simply explain the questions and answers with a small demo:
if the Promise object is not returned in the async function
async function foo() {
let data;
setTimeout(() => {
data = 1;
console.log(data); // 1
return data;
})
}
(async () => {
const data = await foo();
console.log(data); // undefined
})();
// :
// undefined
// 1
After
is changed to correct writing
async function foo() {
let data;
return new Promise((resolve, reject) => {
setTimeout(() => {
data = 1;
resolve(data);
});
});
}
(async () => {
const data = await foo();
console.log(data);
})();
// :
// 1