Resolves a target path from a base path while guaranteeing that the result is
a path that point to or within the base path. This is useful for resolving
paths from user input, as it otherwise opens up for vulnerabilities.
Parameters
base: string
The base directory to resolve the path from.
path: string
The target path, relative or absolute
Returns string
A path that is guaranteed to point to or within the base path.
Resolves a target path from a base path while guaranteeing that the result is a path that point to or within the base path. This is useful for resolving paths from user input, as it otherwise opens up for vulnerabilities.