Function: toFileUrl()
ts
function toFileUrl(path): string;将路径转换为 file:// URL。
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | 要转换的路径 |
Returns
string
file:// URL 字符串
Example
ts
toFileUrl('/foo/bar') // => 'file:///foo/bar'
toFileUrl('C:\\temp\\foo.txt') // => 'file:///C:/temp/foo.txt'
toFileUrl('//host/share/file.txt') // => 'file://host/share/file.txt'Since
1.0.0