我使用 GCF 制作视频编码器
将视频文件从 gcs 下载到/tmp 并通过 ffmpeg 对其进行编码。
我想问一下如何检查文件是否在tmp中下载?
我尝试了 console.log(process.cwd()) 但没有显示 tmp 文件夹
exports.encodeVideo = async (req, res) => {
mkdirp('/tmp')
storage.bucket('video-bucket').file('raw/samplevideo.mp4').download({
destination:'encoded/samplevideo.mp4' })
ffmpeg........
}
最佳答案
download
方法是异步的,所以我能想到的最简单的方法是添加 then
喜欢:
...).download({destination:'encoded/samplevideo.mp4'})
.then ( () => console.log("done") )
});
如果您查看 documentation也有可能添加回调。我认为在回调中处理错误/异常或使用 catch
应该是明智的。 than
之后的方法链.
关于javascript - 检查文件是否从 GCS 在 GCF 中的 temp 中下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63714937/