edgestorejs / edgestore

https://edgestore.dev
397 stars 25 forks source link

How do you delete multiple files? #47

Open Arslan-Soomro opened 5 months ago

Arslan-Soomro commented 5 months ago

I have been using edgestore, and I like it a lot. But I couldn't find how to delete multiple files in a single go, maybe by using filtering with metadata or path. My use case is I store my user's data in this way {userId}/{file}, and when the user closes their account or I want to manually delete them from the system, I first want to delete all their files and then mark them closed in the database so doing something like es.userFiles.delete({ path: { userId: 923udasdiasd9 } }) and it deletes all the files. I am also okay If this could be done with the backend client. If there is no official way to do It I will have to create a wrapper that first gets all the files of user by filtering from path and then deleting them one by one using the url. Would love to know if there is an official way to do it.

perfectbase commented 5 months ago

Hi @Arslan-Soomro

Thank you for the feedback! Unfortunately, right now there isn't an official way to do it. That would indeed be a nice feature! I'll keep this issue here as an enhancement.

Right now I think you would have mainly 2 options.

  1. Use the backend client to make a script. You can use the listFiles function to filter by path or metadata, and then loop it with the deleteFile function.

  2. Use the search bar on the dashboard to filter the path you want to delete and manually use the checkboxes to delete many files at once.

Sorry that this use-case is not well supported right now.