How To Check The Type Of File In Firebase Before Downloading?
I need to download a set of images from Firebase Storage. Before downloading, I need to check the type of Images (i.e. if .jpeg only, only then will I need to download). Can anyone
Solution 1:
The easiest way of doing this is actually writing a Storage Security Rule that disallows downloads unless the file has a content type of image/*
:
service firebase.storage {
match /b/<your-firebase-storage-bucket>/o {
match /images/{imageId} {
allow read: if resource.contentType.matches('image/.*');
}
}
}
}
See more in the docs.
Post a Comment for "How To Check The Type Of File In Firebase Before Downloading?"