Guest User

Untitled

a guest
Jan 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import * as functions from "firebase-functions";
  2. import * as admin from "firebase-admin";
  3. const firebase = admin.initializeApp();
  4.  
  5. export const deletePhotos = functions.firestore
  6. .document("posts/{postId}")
  7. .onDelete((snap, context) => {
  8. const { postId } = context.params;
  9. const bucket = firebase.storage().bucket();
  10.  
  11. return bucket.deleteFiles({
  12. prefix: `images/${postId}`
  13. });
  14. });
Add Comment
Please, Sign In to add comment