Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Augments Node.js’s URL library
branch: master

Merge pull request #5 from wtfil/master

Bump version of URL.
latest commit 484a93bdcb
Kris Kowal authored
Failed to load latest commit information.
test Fix issue with relative paths through base
.gitignore FIRST!
.travis.yml FIRST! FIRST! FIRST!
package.json bump version of url
url2.js Fix issue with relative paths through base


This module builds upon the existing URL module in NodeJS, but adds relative(source, target) which returns the shortest relative path between any two equally qualified URL’s. If the paths are not equally qualified, it returns the target.

In addition, this package augments the URL object definition as returned by parse and consumed by format.

  • pathname is broken down into
    • root: whether the path is qualified from the root of the domain.
    • relative: the relative path, from the root if pathname is qualified from the domain root.
      • directories: an array of path components
      • file: the name of the file, or null if the URL points to a directory, indicated by a final slash.

Additionally, format uses the path property if it exists, instead of pathname and search.

Based on my earlier work for Narwhal.

Copyright 2012 Kristopher Michael Kowal. All rights reserved. MIT License

Something went wrong with that request. Please try again.