buckets
table permissions: noneobjects
table permissions: select
The path of the file you want to download.
Additional options for the download.
val bucket = supabase.storage.from("avatars")
val bytes = bucket.downloadAuthenticated("test.png")
//or on JVM:
bucket.downloadAuthenticatedTo("test.png", File("test.png"))
val bucket = supabase.storage.from("avatars")
val bytes = bucket.downloadPublic("test.png")
//or on JVM:
bucket.downloadPublicTo("test.png", File("test.png"))
val bucket = supabase.storage.from("avatars")
val bytes = bucket.downloadPublic("test.png") {
transform {
size(100, 100)
fill()
quality = 100
}
}
//or on JVM:
bucket.downloadPublicTo("test.png", File("test.png")) {
transform {
size(100, 100)
fill()
quality = 100
}
}
val bucket = supabase.storage.from("avatars")
bucket.downloadAuthenticatedAsFlow("icon.png").collect {
when(it) {
is DownloadStatus.ByteData -> println("Downloaded ${it.data.size} bytes")
is DownloadStatus.Progress -> println("Downloaded ${it.totalBytesReceived.toFloat() / it.contentLength * 100}%")
DownloadStatus.Success -> println("Downloaded successfully")
}
}
//or on JVM:
bucket.downloadAuthenticatedToAsFlow("icon.png", File("icon.png")).collect {
when(it) {
is DownloadStatus.Progress -> println("Downloaded ${it.totalBytesReceived.toFloat() / it.contentLength * 100}%")
DownloadStatus.Success -> println("Downloaded successfully")
else -> {} //The ByteData status will never occur as we are writing directly to a file
}
}