Closed fisker closed 2 years ago
I would prefer not to introduce a dependency for this. I have worked very hard in the past year to reduce the amount of dependencies I use. In this case, it's really just cwd.startsWith('file://') ? fileURLToPath(cwd) : cwd
.
I think Node.js should expose a method for this. It's such a common need now that everything is starting to support URL
. Maybe you wanna open an issue about it on the Node.js repo?
path.from(string | URL)
would be nice API.
Removed dependency, and added test for file:
string too.
It's such a common need now that everything is starting to support URL. Maybe you wanna open an issue about it on the Node.js repo?
I think this is a temporary need. Once everything supports URL
, convert to path won't be necessary. Anyway, https://github.com/nodejs/node/issues/41521
I think this is a temporary need. Once everything supports URL, convert to path won't be necessary. Anyway,
No, there will always be a need as your argument only works if you directly pass the input to a Node.js API. Many packages manipulate the paths somehow and dealing with path and not URL is much nicer then.
I build
url-or-path
few months ago, it actually acceptpath
,URL
andURL.href
, should we add test forURL.href
too?Fixes #176