import taficloud.Taficloud
val tafiCloud = Taficloud("YOUR_API_KEY")
val file = File("path/to/file")
val response = taficloud.upload(file.readBytes(), fileName = file.name, folder = "samples")
println(response)
val base64 = "base64 string"
val response = taficloud.uploadBase64(base64, "samples")
println(response)
val files = mapOf(
File("path/to/file1").readBytes() to "file1",
File("path/to/file2").readBytes() to "file2"
)
val response = taficloud.upload(files)
println(response)
val response = taficloud.downloadFile("YOUR_MEDIA_KEY")
val dir = File("src/main/resources/downloads")
dir.mkdirs()
val output = File(dir, "/download.png")
output.createNewFile()
output.writeBytes(response)
println(response)
val file = File("path/to/file")
val response = taficloud.compressPng(
file = file.readBytes(),
fileName = file.name,
compressionLevel = 5,
adaptiveFiltering = false,
palette = false,
quality = 50,
effort = 5
)
val dir = File("src/main/resources/downloads")
dir.mkdirs()å
val output = File(dir, "/coolio_compressed.png")
output.createNewFile()
output.writeBytes(response)
println(response)