我是一名开发新手,最近刚开始接触编程。
这是一个自动下载然后将文件上传到另一个网站的代码。
我不知道我在这段代码中做错了什么,但是 await
关键字不起作用。在运行下一个函数之前,函数不会等待完成。
automator = async (MYP_page) => {
// get all the Data in JSON [function 1]
vidData = await getData(MYP_page)
// download the video [function 2]
downloadedVideo = await getVid(vidData.MYP_source, vidData.Title);
// [function 3]
console.log("Video Downloaded", "\n", "Now attempting to copy to another Folder")
// move the video to Local OneDrive Folder [function 4]
await move2oneDriveLocal(downloadedVideo.absolutePath, "C:/Users/prana/OneDrive/TM media/TM_Vids");
// upload the video [function 5]
// uploadVid(`${vidData.Title}.mp4`)
write('P3.csv', fields, vidData);
};
所有外部函数都是异步的并且也被检查。
.then
方法似乎效果不佳。