简体   繁体   English

有没有办法从 firebase 存储中删除图像文件夹

[英]Is there any way to delete a folder of images from firebase storage

I tried this:我试过这个:

methods: {
    async deleteCard(mediaRef) {
      // mediaRef is equal to reference of the images folder
      await this.$fire.storage.ref('albums_cards').child(mediaRef).delete()
    },
  },

error:错误:

Firebase Storage: Object 'albums_cards/ 88b8f000-6dd0-11ed-9c2d-afa013ab0c4b ' does not exist. Firebase 存储:Object 'albums_cards/ 88b8f000-6dd0-11ed-9c2d-afa013ab0c4b ' 不存在。 (storage/object-not-found) (存储/未找到对象)

but as you see in the picture it exists.但正如您在图片中看到的那样,它存在。 I think the method which I used is to delete specific file, but I want to delete folder.我认为我使用的方法是删除特定文件,但我想删除文件夹。

Is there any way to do it?有什么办法吗?

在此处输入图像描述

Currently firebase doesn't support deleting directories and it is a known issue.目前firebase不支持删除目录,这是一个已知问题。 You can only delete individual files.您只能删除单个文件。 So, it's best to store a reference to those files and remove them one by one.因此,最好存储对这些文件的引用,然后将它们一一删除。

As mentioned here Firebase Storage does not work with folders.如此处所述Firebase Firebase Storage不适用于文件夹。 Folders actually don't exist, only files.文件夹实际上不存在,只有文件。 You can upload files to a specific location/path but their entire filesystem is closer to a flat hash table where you store path/file pairs, than to a file system with multiple folder levels.您可以将文件上传到特定位置/路径,但它们的整个文件系统更接近于存储路径/文件对的平面 hash 表,而不是具有多个文件夹级别的文件系统。

You can check the following links for deleting files individually: link1 , link2 and link3您可以检查以下链接以单独删除文件: link1link2link3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM