tootallnate / file-uri-to-path Goto Github PK
View Code? Open in Web Editor NEWConvert a `file:` URI to a file path
License: MIT License
Convert a `file:` URI to a file path
License: MIT License
Hi there!
Would you mind including the full text of the license? It helps with packaging for Linux distros.
Cheers!
Passing in file:///C:/P%C3%A9ter/test.txt
returns C:\\Péter\\test.txt
instead of C:\\Péter\\test.txt
(note that %C3%A9
is the correct representation of é
).
The fix should be trivial:
In this line you use the deprecated unescape
function instead of decodeURI
(which correctly handles the above case).
BTW, awesome package (together with get-uri
)! It's super light-weight helper packages like these that make developing for node so much fun 😄
If the file uri has a percentage in it, it seems to not convert it properly.
Such as file:///c%3A/Users/Admin/Desktop/Github_Stuff/Discord_Bots/StratoBotElite/branches/master/src/bot/commands/Logging/user-join.js
will return /c%3A/Users/Admin/Desktop/Github_Stuff/Discord_Bots/StratoBotElite/branches/master/src/bot/commands/Logging/user-join.js
while file:///c:/Users/Admin/Desktop/Github_Stuff/Discord_Bots/StratoBotElite/branches/master/src/bot/commands/Logging/user-join.js
will return c:/Users/Admin/Desktop/Github_Stuff/Discord_Bots/StratoBotElite/branches/master/src/bot/commands/Logging/user-join.js
Hi @TooTallNate!
I'm evaluating this package and thought that it might benefit from using the built-in url package from Node. Would you be up for a PR?
Hi
I am having trouble installing a package that requires this module.
npm install system-sleep
npm WARN tarball tarball data for file-uri-to-path@https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz (sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for file-uri-to-path@https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz (sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==) seems to be corrupted. Trying again.
npm ERR! code ENOENT
npm ERR! syscall lstat
The definition of a URI is:
scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
(https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#URL_and_URN)
So the // is optional. At the moment, the validation fails unless the slashes are included.
Expected
Any URI starting with "file:" is accepted
Actual
URIs are rejected unless they begin"file://"
This is causing issues when using this library in a system with URIs produced by other libraries.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.