0.2.0 • Published 7 years ago

unix-path v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

unix-path

npm

Drop-in node.js path replacement that converts all results to Unix-style paths.

A simpler and more minimal upath without any dependency.

Patched methods and properties

  • resolve
  • normalize
  • isAbsolute
  • join
  • relative
  • dirname
  • basename
  • extname
  • format
  • sep
  • delimiter

Additional methods

  • toUnixPath: (string) => string: Convert Windows-style path to Unix-style path.
  • patch: (PathModule) => PatchedPathModule: Create a new patched object.

Example

Assuming we are on a Windows host:

const upath = require('unix-path');

const parsed = upath.parse('C:\\\\Windows\\System32\\sethc.exe');
// {
//   root: '/c/',
//   dir: '/c/Windows/System32',
//   base: 'sethc.exe',
//   ext: '.exe',
//   name: 'sethc'
// }

const joined = upath.join('foo\\bar', 'baz/qux');
// "foo/bar/baz/qux"

Try it online

Notes

  • Windows drive letters are converted "Git Bash" style (C:\\ => /c/)
  • Requires Node.js >= v6
0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago