Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
How can I remove an entire folder under Storage?

I have a problem deleting my entire folder on firebase storage. I always get a 'storageRef.listAll is not a function' error when I specify the reference to the path. I would like to delete the complete path with all possibly existing images.

const storage = getStorage();

const storageRef = ref(
  storage,
  `${aktuellerUser._id}/artikelBilder/`
);

storageRef
  .listAll()
  .then((listResults) => {
    const promises = listResults.items.map((item) => {
      return item.delete();
    });
    Promise.all(promises);
  })
  .catch((error) => {
    console.log(error);
  });

error TypeError: storageRef.listAll is not a function

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are using the new Firebase Modular SDK where listAll() is a top level function and not a method on StorageReference. Similarly, you need to use deleteObject() to delete a file now instead of .delete() method as shown below:

import {
  getStorage,
  ref,
  listAll,
  deleteObject
} from "firebase/storage";

listAll(storageRef)
  .then(async (listResults) => {
    const promises = listResults.items.map((item) => {
      return deleteObject(item);
    });

    await Promise.all(promises);
  })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!