downloadFileContentTo
abstract suspend fun downloadFileContentTo(fileId: String, file: KoryFile, onProgress: UploadFileProgressListener<SingleFileProgress>? = null): Long
Downloads a file's content and writes it to a KoryFile.
Return
The total number of bytes written.
Parameters
fileId
The ID of the file to download.
file
The destination file.
onProgress
Optional listener for download progress (0.0–1.0).
Samples
// To download file content to file, use a downloadFileContentTo() function.
val file = KoryFile.create("file.ext")
client.downloadFileContentTo("file_id", file) { progress ->
println("Downloading file to ${file.getName()}\nProgress: ${progress.percentage}%")
}Content copied to clipboard