简体   繁体   中英

Firebase Cloud function Temp Storage

I made a cloud function in Firebase that resizes images. Therefore, I download the image and save it in the temp storage.

const tmp = require('tmp-promise');
const { path: tmpDirPath } = await tmp.dir();

https://www.npmjs.com/package/tmp-promise

The firebase documentation says "Always delete temporary files". https://firebase.google.com/docs/functions/tips#write_idempotent_functions

Does this package do this automatically or is there a specific code I should run? Will this interfere if the function gets triggered multiple times (having multiple instances each converting a picture at the same time)?

Thanks in advance!

That library would have no way of knowing when it's time to delete any files it creates. Only you know that, and you'll have to code your function to delete those files just before the function terminates, and the files are no longer in use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM