How to list files in Firebase storage in a specific directory (eg: /test),
Here is what I tried :
var query = {
delimiter: 'test/'
};
const storageRef = admin.storage().bucket().getFiles(query, function(err, files, nextQuery, apiResponse) {
console.log(files);
}
but it returns files at the root of the bucket..
Any idea?
If you want the file path on firebase storage to access it via storage reference and not URL, you can use taskSnapshot. getStorage().
Save and categorize content based on your preferences. Cloud Storage for Firebase allows you to list the contents of your Cloud Storage bucket.
There is no way to list files, search for files or filter files within the Firebase Storage API. There are some such features in the gcloud API, which can also be used on Firebase Storage. This user is first on the weekly Google Cloud leaderboard.
The new Firebase Storage is powered by Google Cloud Storage, giving it massive scalability and allowing stored files to be easily accessed by other projects running on Google Cloud Platform. Firebase now uses the same underlying account system as GCP, which means you can use any GCP product with your Firebase app.
It looks like you're not passing the correct object to getFiles(). The documentation for the GetFilesRequest object suggests that you should be passing a property called directory
, not delimiter
. If you want all the files under /test
, then pass { directory: '/test' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With