diff options
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index 95b5e9c5fd4..cf0271691a5 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1377,6 +1377,12 @@ function getPathFromURL(path) { return isWindows ? getPathFromURLWin32(path) : getPathFromURLPosix(path); } +function getURLFromFilePath(filepath) { + const tmp = new URL('file://'); + tmp.pathname = filepath; + return tmp; +} + function NativeURL(ctx) { this[context] = ctx; } @@ -1405,6 +1411,7 @@ setURLConstructor(constructUrl); module.exports = { toUSVString, getPathFromURL, + getURLFromFilePath, URL, URLSearchParams, domainToASCII, |