emptyBucket()

Removes all objects inside a single bucket.

1const { data, error } = await supabase
2  .storage
3  .emptyBucket('avatars')

Parameters#

  • idrequired
    string

    The unique identifier of the bucket you would like to empty.

Notes#

  • RLS policy permissions required:
    • buckets table permissions: select
    • objects table permissions: select and delete
  • Refer to the Storage guide on how access control works

Examples#

Empty bucket#

1const { data, error } = await supabase
2  .storage
3  .emptyBucket('avatars')