-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Add a utility to convert file URL or path to one of them? #41521
Copy link
Copy link
Open
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.never-staleMark issue so that it is never considered staleMark issue so that it is never considered staleurlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.never-staleMark issue so that it is never considered staleMark issue so that it is never considered staleurlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Type
Projects
Status
Triaged
What is the problem this feature will solve?
It's a nice way to accept both
URLand path string in API, but we need covert it to either string or URL, it would be nice to have a built-in method to do this.What is the feature you are proposing to solve the problem?
For converting to string:
Maybe add
path.from(URL | string)? @sindresorhus proposed here.For converting to URL:
url.from(URL | string)I'm not sure, since
URLis a standard, I guess adding methodURLobject won't be acceptable, maybe tonode:urlmodule?What alternatives have you considered?
No response