【发布时间】:2017-11-23 00:37:06
【问题描述】:
我正在为我的 web 应用程序使用 Cloud Functions for Firebase。我需要为上传到 Firebase 存储的任何图像创建缩略图。为此,我需要将上传的文件从 GCS 存储桶下载到临时目录(使用 mkdirp-promise),然后应用 imageMagick 命令创建缩略图。 (Firebase Function Samples- Generate Thumbnail)
return mkdirp(tempLocalDir).then(() => {
console.log('Temporary directory has been created', tempLocalDir);
// Download file from bucket.
return bucket.file(filePath).download({
destination: tempLocalFile
});
}).then(() => {
//rest of the program
});
});
我的问题是:
-
temp目录是在哪里创建的? - 此临时存储是否计入我的 Firebase 云存储或 Google 云存储配额?
- 成功上传新创建的缩略图文件后,如何清理临时目录?这样我的配额就不会超过。
【问题讨论】:
标签: firebase firebase-storage google-cloud-functions