I am trying to get the list of images in a directory from firebase storage.
Example I want to get all image in users/userid/images , but it does not work and popup an error which the function is undefined.
const listRef = storageRef.child('users/userid/images');
listRef.listAll().then(res=>{
res.items.forEach(itemRef=>{
// console.log(itemRef);
});
}).catch(e =>{});
The ability to list files in a storage bucket wasn't added until version 6.1.0 of the JavaScript SDK . So make sure your SDK is up to date.
And now we can do it as well, thnk you from react-native-firebase
team.
const reference = storage().ref('images');
const getListOfImages = async (){
const res = await reference.child('profileimages').list();
return await Promise.all(res.items.map(i => i.getDownloadURL()));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.