I am using Cloud Functions for Firebase for my webapp. I need to create thumbnail for any image uploaded on Firebase Storage. For that I need to download the uploaded file from GCS bucket to temp directory(using mkdirp-promise
), and apply imageMagick
command to create a thumbnail. (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
});
});
My Question is:
- where is this
temp
directory created? - Is this temp storage counted against my firebase cloud storage or Google cloud Storage quota?
- How can I cleanup my temp directory, after i have successfully uploaded newly created thumbnail file? So that my quota doesnt exceed.