toFileData

fun ByteArray.toFileData(filename: String, contentType: String?, offset: Int = 0, length: Int = size - offset): FileData(source)

Converts a ByteArray to a FileData object.

Return

the FileData representing this file

Parameters

offset

the offset to start reading from

length

the length to read until

filename

the name of the file

contentType

the content type of the file


fun ByteArray.toFileData(filename: String, offset: Int = 0, length: Int = size - offset): FileData(source)

Deprecated

Use toFileData(String, String?, Int, Int) instead.

Replace with

toFileData(filename, null, offset, length)
fun File.toFileData(contentType: String? = null): FileData(source)

Converts a File to a FileData object.

Return

the FileData representing this file


fun Path.toFileData(contentType: String? = null): FileData(source)

Converts a Path to a FileData object.

Return

the FileData representing this file