Convert between file URL and path.
yarn add url-or-path
import {toUrl, toPath} from 'url-or-path'
console.log(toUrl(urlOrPath))
//=> URL {/* ... */}
console.log(toPath(urlOrPath))
//=> 'path/to/file'
Type: string | URL
Returns a URL
object of given URL or path string.
Type: string | URL
Returns path string of given URL or path string.
Type: string | URL
Same as toUrl
, but the result URL always ends with /
.
Check if value
is a URL
instance or a string starts with file://
.
Check if value
is a URL
instance.
Check if value
is a string starts with file://
.