Skip to content

enable from.remove() to delete folders #207

Open
@RyanTippsTX

Description

@RyanTippsTX

Feature request - delete folders

Is your feature request related to a problem? Please describe.

With supabase storage, folders are deleted automatically when their contents are deleted, but there's no way to delete a whole folder at once, and there's no (clean) way to delete empty folders.

Describe the solution you'd like

I would like for this to work:

const { data, error } = await supabase.storage
  .from('bucket')
  .remove(['path/to/folder'], {
    force: true, // required if folder isnt empty
  });

Describe alternatives you've considered

For 'empty folders' that were created in the supabase web app, they can apparently be deleted like this:

const { data, error } = await supabase.storage
      .from('bucket')
      .remove(['folder/.emptyFolderPlaceholder']);

^ but this is clunky, and you have to know that that placeholder file is there.

And for deleting a folder that has multiple contents, it can be done much more verbosely using .list() and .remove() , but this is a pain, especially if there are nested folders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions