summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/path/_win32.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/path/_win32.ts')
-rw-r--r--ext/node/polyfills/path/_win32.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/ext/node/polyfills/path/_win32.ts b/ext/node/polyfills/path/_win32.ts
index 856ffdff5..dccd00d3c 100644
--- a/ext/node/polyfills/path/_win32.ts
+++ b/ext/node/polyfills/path/_win32.ts
@@ -17,7 +17,6 @@ import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
import {
_format,
assertPath,
- encodeWhitespace,
isPathSeparator,
isWindowsDeviceRoot,
normalizeString,
@@ -951,34 +950,6 @@ export function parse(path: string): ParsedPath {
return ret;
}
-/**
- * Converts a path string to a file URL.
- *
- * ```ts
- * toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
- * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
- * toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
- * ```
- * @param path to convert to file URL
- */
-export function toFileUrl(path: string): URL {
- if (!isAbsolute(path)) {
- throw new TypeError("Must be an absolute path.");
- }
- const [, hostname, pathname] = path.match(
- /^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/,
- )!;
- const url = new URL("file:///");
- url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
- if (hostname != null && hostname != "localhost") {
- url.hostname = hostname;
- if (!url.hostname) {
- throw new TypeError("Invalid hostname.");
- }
- }
- return url;
-}
-
export default {
basename,
delimiter,
@@ -992,6 +963,5 @@ export default {
relative,
resolve,
sep,
- toFileUrl,
toNamespacedPath,
};