package
Resolve a relative path against a root path with validation
npm install resolve-pathGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Resolve a relative path against a root path with validation.
This module would protect against commons attacks like GET /../file.js
which reaches outside the root folder.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install command:
$ npm install resolve-pathvar resolvePath = require('resolve-path')Resolve a relative path against process.cwd() (the process's current working
directory) and return an absolute path. This will throw if the resulting resolution
seems malicious. The following are malicious:
process.cwd()process.cwd() and back downResolve a relative path against the provided root path and return an absolute path. This will throw if the resulting resolution seems malicious. The following are malicious:
var http = require('http')
var parseUrl = require('parseurl')
var path = require('path')
var resolvePath = require('resolve-path')
// the public directory
var publicDir = path.join(__dirname, 'public')
// the server
var server = http.createServer(function onRequest (req, res) {
try {
// get the pathname from the URL (decoded)
var pathname = decodeURIComponent(parseUrl(req).pathname)
blakeembrey
hello@blakeembrey.com
Estimated unpacked size across 8 packages.
82.3 kB
Includes dependencies.
1.0.1
2.0.0