enable from.remove() to delete folders

Open
#207 16 comments 48 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start at the storage client's .from().remove() entry point and review how remove() currently handles object paths. Compare the requested force behavior with existing list() and remove() flows; done means folder paths, including non-empty and empty folders, can be removed through the API with coverage for both cases.

Written by the indexing model from the issue text.

Description

enhancement

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.

Dominant language
TypeScript
Stars
1.3k
Forks
307
Avg merge
1d 22h
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/storage

All issues in supabase/storage

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.