Created
July 31, 2018 05:42
-
-
Save saurav12994/4af73ffe24aff3fde3c9237aebe38c38 to your computer and use it in GitHub Desktop.
Delete Folder in Firebase cloud storage using Cloud Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I hava a folder inside CustomerDocuments in Firebase cloud storage name xyz which contains many types of file like .pdf,.txt,.png etc. | |
function deletefromstorage(quoteiddelete) | |
{ | |
//quoteiddelete contains folder name in CustomerDocuments which we want to delete. | |
const Storage = require('@google-cloud/storage'); | |
const storage = new Storage(); | |
const srcBucketName = 'abc.apot.com'; | |
return storage.bucket(srcBucketName).deleteFiles({ | |
prefix: 'Customerdocuments/'+quoteiddelete+'/' | |
}, function(err) { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log(`All the Firebase Storage files in have been deleted`); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment