jack e1a2621c78 update | 2 years ago | |
---|---|---|
.. | ||
test | 2 years ago | |
.npmignore | 2 years ago | |
.travis.yml | 2 years ago | |
CONTRIBUTING.md | 2 years ago | |
LICENSE-MIT | 2 years ago | |
LICENSE-WTFPL | 2 years ago | |
README.md | 2 years ago | |
index.js | 2 years ago | |
package.json | 2 years ago |
Convert relative file system paths into safe URI paths
npm install --save uri-path
var URIpath = require('uri-path');
// Properly encode URI path segments
URIpath('../abc/@#$%¨&()[]{}-_=+ß/môòñ 月 قمر');
// -> '../abc/%40%23%24%25%C2%A8%26()%5B%5D%7B%7D-_%3D%2B%C3%9F/m%C3%B4%C3%B2%C3%B1%20%E6%9C%88%20%D9%82%D9%85%D8%B1'
// Also supports paths with Windows directory separators
URIpath('a\\b\\c');
// -> 'a/b/c'