-
-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Add a utility to convert file URL or path to one of them? #41521
Copy link
Copy link
Open
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.never-staleIssues and PRs exempt from automated stale handling.Issues and PRs exempt from automated stale handling.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Description
Activity
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.never-staleIssues and PRs exempt from automated stale handling.Issues and PRs exempt from automated stale handling.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Type
Projects
- StatusShow more project fieldsTriaged
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