asUrl

fun asUrl(fileOrUrl: String): URL

Converts a file path or URL String to a URL. If the path is a file path, the file is checked for existence and not being a directory.