fromPathCatching

Creates a KoryFile from a path, wrapping the result in a Result.

Return

A Result with either a KoryFile or a FileNotFoundException.

Parameters

path

The path to the file.

Samples

// You can get file as Result<KoryFile> using fromPathCatching function.
KoryFile.fromPathCatching(filePath).onSuccess { file ->
    println(file.mimeTypeStr())
}.onFailure { th ->
    println(th)
}