Storage

interface Storage : MainPlugin<Storage.Config> , CustomSerializationPlugin(source)

Plugin for interacting with the Supabase Storage API

To use it you need to install it to the SupabaseClient:

val supabase = createSupabaseClient(supabaseUrl, supabaseKey) {
install(Storage)
}

then you have to interact with the Storage API like this:

val bucket = supabase.storage.from("icons")
val bytes = bucket.downloadAuthenticated("icon.png")

Types

Link copied to clipboard
object Companion : SupabasePluginProvider<Storage.Config, Storage>
Link copied to clipboard
data class Config(var transferTimeout: Duration = 120.seconds, resumable: Storage.Config.Resumable = Resumable(), var serializer: SupabaseSerializer? = null, var requireValidSession: Boolean = false) : MainConfig, CustomSerializationConfig, AuthDependentPluginConfig

Config for the storage plugin

Properties

Link copied to clipboard

Access vector storage operations.

Link copied to clipboard

The API used for network requests.

Link copied to clipboard
abstract val apiVersion: Int
Link copied to clipboard
abstract val config: Storage.Config
Link copied to clipboard
abstract val logger: SupabaseLogger
Link copied to clipboard
abstract val pluginKey: String
Link copied to clipboard
abstract val serializer: SupabaseSerializer
Link copied to clipboard
abstract val supabaseClient: SupabaseClient
Link copied to clipboard

Access analytics storage operations using Iceberg tables.

Functions

Link copied to clipboard
open suspend fun close()
Link copied to clipboard
abstract suspend fun createBucket(id: String, builder: BucketBuilder.() -> Unit = {})

Creates a new bucket in the storage

Link copied to clipboard
abstract suspend fun deleteBucket(bucketId: String)

Deletes a bucket by its bucketId

Link copied to clipboard
abstract suspend fun emptyBucket(bucketId: String)

Empties a bucket by its bucketId

Link copied to clipboard
open fun from(bucketId: String): BucketApi

Builder function for interacting with a bucket with the given bucketId

Link copied to clipboard
abstract operator fun get(bucketId: String): BucketApi

Builder function for interacting with a bucket with the given bucketId

Link copied to clipboard
abstract suspend fun getBucket(bucketId: String): Bucket?

Retrieves a bucket by its bucketId

Link copied to clipboard
open fun init()
Link copied to clipboard
abstract suspend fun listBuckets(filter: StorageListFilter.Buckets.() -> Unit = {}): List<Bucket>

Returns all buckets in the storage

Link copied to clipboard
abstract suspend fun parseErrorResponse(response: HttpResponse): RestException
Link copied to clipboard
abstract suspend fun purgeBucketCache(id: String, options: PurgeCacheOptions.() -> Unit = {})

Purges the CDN cache for an entire bucket.

Link copied to clipboard
open fun resolveUrl(path: String): String
Link copied to clipboard
abstract suspend fun updateBucket(id: String, builder: BucketBuilder.() -> Unit = {})

Updates a bucket in the storage