convert a url string to an actual URL object.
your input path url can use any scheme supported by the getUriScheme function.
and you may also use paths with windows dir-separators ("\"), as this function implicitly converts them a posix separator ("/").
if you pass a URL object, then it will be returned as is.
Throws
Error an error will be thrown if base uri is either a relative path, or uses a data uri scheme,
or if the provided path is relative, but no absolute base path is provided.
err(() =>fn("./a/b.txt", "data:text/plain;charset=utf-8;base64,aGVsbG8=")) err(() =>fn("./a/b.txt", "blob:https://example.com/4800d2d8-a78c-4895-b68b-3690b69a0d6a")) err(() =>fn("./a/b.txt", "./path/")) // a base path must not be relative err(() =>fn("./a/b.txt")) // a relative path cannot be resolved on its own without a base path
convert a url string to an actual
URL
object. your inputpath
url can use any scheme supported by the getUriScheme function. and you may also use paths with windows dir-separators ("\"), as this function implicitly converts them a posix separator ("/").if you pass a
URL
object, then it will be returned as is.Throws
Error
an error will be thrown ifbase
uri is either a relative path, or uses a data uri scheme, or if the providedpath
is relative, but no absolutebase
path is provided.Example