Skip to main content
Version: v2 RC

emptyBucket()

Removes all objects inside a single bucket.

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

Parameters

  • idrequiredstring

    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

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