const admin = require("firebase-admin");admin.initializeApp();...exports.deleteTranscriptMedia = functions.firestore.document("transcripts/{transcriptId}").onDelete(async (snap, context) => {const defaultStorage = admin.storage();const deletedValue = snap.data();const storageRefPath = deletedValue.storageRef;const bucket = defaultStorage.bucket();// const file = bucket.file('profilePicture/' + userID + '.png');const file = bucket.file(storageRefPath);// Delete the filereturn file.delete()});
​Automatically delete your Firebase Storage Files from Firestore with Cloud Functions for Firebase​