File: README.md

package info (click to toggle)
node-uri-path 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 100 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# uri-path
[![NPM version](https://badge.fury.io/js/uri-path.png)](https://npmjs.org/package/uri-path)
[![Build Status](https://travis-ci.org/UltCombo/uri-path.png?branch=master)](https://travis-ci.org/UltCombo/uri-path)
[![devDependency Status](https://david-dm.org/UltCombo/uri-path/dev-status.png)](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'
```