Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. // Your web app's Firebase configuration
  2. var firebaseConfig = {
  3. apiKey: "",
  4. authDomain: "",
  5. databaseURL: "",
  6. projectId: "",
  7. storageBucket: "",
  8. messagingSenderId: "",
  9. appId: ""
  10. };
  11. // Initialize Firebase
  12. firebase.initializeApp(firebaseConfig);
  13.  
  14. var storage = firebase.storage();
  15. var storageRef = storage.ref();
  16.  
  17. //! List All Albums
  18. storageRef
  19. .listAll()
  20. .then(result => {
  21. result.prefixes.forEach(element => {
  22. displayAlbum(storageRef.child(`${element.fullPath}`));
  23. // console.log(element.fullPath);
  24. });
  25. })
  26. .catch(err => console.log(err));
  27.  
  28. // List All Photos In That Album
  29. function displayAlbum(albumRef) {
  30. albumRef
  31. .listAll()
  32. .then(result => {
  33. result.items.forEach(element => {
  34. element
  35. .getDownloadURL()
  36. .then(url => console.log(url))
  37. .catch(err => console.log("Error In Getting"));
  38. });
  39. })
  40. .catch(err => console.log(err));
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement