Hi. Quick question about a couple of Storage-KT f...
# supabase-kt
b
Hi. Quick question about a couple of Storage-KT functions. In the docs, like here, it says:
Copy code
val bucket = supabase.storage.from("avatars")
bucket.upload("myIcon.png", byteArray, upsert = false)
//on JVM you can use java.io.File
bucket.upload("myIcon.png", file, upsert = false)
Or under "Create resumable upload":
Copy code
...
//JVM/Android:
val upload = bucket.resumable.createOrContinueUpload("icon.png", File("icon.png"))
//Other platforms:
val upload = bucket.resumable.createOrContinueUpload(data = byteArray, source = "this is for continuing previous uploads later", path = "icon.png")
...
Seems that the JVM/Android approach can use Files, while other platforms can only use ByteArrays. My question is whether the "Other platforms" ByteArray approach can also be used for on JVM/Android?
j
Yes, the JVM functions requiring a file as parameter basically just call these functions in the end. It might be good to mention that there should also be a function variant accepting a lambda, which provides a ByteReadChannel. This is what is actually being used for the file variant to read data while uploading and not at once as a ByteArray. But that is obviously also fine.
b
Perfect 👌🏼 Thank you for the explanation. PS: I hope it's not an issue for me to ask question here that I might be able to find out myself. It might be useful for others looking for answers in the future.
j
I hope it's not an issue for me to ask question here that I might be able to find out myself. It might be useful for others looking for answers in the future
Thats exactly why this channel exists 🙂