Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

274
Vistas
list all files in firebase storage v9

I am developing a page and am using firebase storage as the file storage. I tried using the given codes in the firebase developer docs but I can't seem to make it work. What could be the problem?

document.getElementById("but").addEventListener('click', e => {

    // Create a reference under which you want to list
    const listRef = ref(storage, 'folder/');
    // Find all the prefixes and items.
    listAll(listRef)
        .then((res) => {
            res.prefixes.forEach((folderRef) => {
                // All the prefixes under listRef.
                // You may call listAll() recursively on them.
            });
            res.items.forEach((itemRef) => {
                // All the items under listRef.
                console.log( getDownloadURL(ref(storage, `folder/${itemRef}`)))
            })
        })
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm not sure what problem you have with the code, but one mistake is in :

res.items.forEach((itemRef) => {
    // All the items under listRef.
    console.log( getDownloadURL(ref(storage, `folder/${itemRef}`)))
})

The getDownloadURL function performs an asynchronous call to the server, so you'll need to either use await or then to capture that result:

res.items.forEach((itemRef) => {
    getDownloadURL(ref(storage, `folder/${itemRef}`))
        .then((downloadURL) => {
            console.log(downloadURL);
        });
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda