summaryrefslogtreecommitdiff
path: root/std/node
diff options
context:
space:
mode:
Diffstat (limited to 'std/node')
-rw-r--r--std/node/url.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/std/node/url.ts b/std/node/url.ts
index 70e1645b6..82daa25e9 100644
--- a/std/node/url.ts
+++ b/std/node/url.ts
@@ -39,6 +39,10 @@ const tabRegEx = /\t/g;
const _url = URL;
export { _url as URL };
+/**
+ * Get fully resolved platform-specific file path from the given URL string/ object
+ * @param path The file URL string or URL object to convert to a path
+ */
export function fileURLToPath(path: string | URL): string {
if (typeof path === "string") path = new URL(path);
else if (!(path instanceof URL)) {
@@ -108,6 +112,7 @@ function getPathFromURLPosix(url: URL): string {
return decodeURIComponent(pathname);
}
+/** Get fully resolved platform-specific File URL from the given file path */
export function pathToFileURL(filepath: string): URL {
let resolved = path.resolve(filepath);
// path.resolve strips trailing slashes so we must add them back