https://github.com/ultcombo/uri-path
Convert relative file system paths into safe URI paths
https://github.com/ultcombo/uri-path
Last synced: 10 months ago
JSON representation
Convert relative file system paths into safe URI paths
- Host: GitHub
- URL: https://github.com/ultcombo/uri-path
- Owner: UltCombo
- License: mit
- Created: 2014-06-29T23:00:44.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-24T00:36:58.000Z (over 10 years ago)
- Last Synced: 2025-08-26T09:59:33.072Z (10 months ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# uri-path
[](https://npmjs.org/package/uri-path)
[](https://travis-ci.org/UltCombo/uri-path)
[](https://david-dm.org/UltCombo/uri-path#info=devDependencies)
Convert relative file system paths into safe URI paths
# Install
```
npm install --save uri-path
```
# Usage
```js
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'
```