path-join-safe

1.0.0 • Public • Published

path-join-safe

Join pathes, return undefined if the resulting path is not within the path passed as the first argument.

Usage

The module extends node's path.posix and path.win32 with joinSafe methods, so it can be used like this:

const path = require('path')
/*const joinSafe = */require('path-join-safe') //joinSafe == path.joinSafe
let safe_path = path.posix.joinSafe('a/b/c', 'd') //returns 'a/b/c/d'
let unsafe_path = path.joinSafe('a/b/c', '..') //returns undefined

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    6

Package Sidebar

Install

npm i path-join-safe

Weekly Downloads

6

Version

1.0.0

License

ISC

Last publish

Collaborators

  • grabantot