assertPathWithinAsync
assertPathWithinAsync(
root,path,options?):Promise<string>
Defined in: packages/node/src/fs/path-within.ts:279
Require that path stays inside root once both are resolved through
symbolic links, and hand back the real path.
Same semantics and the same TOCTOU caveat as isPathWithinAsync; use the returned path rather than the argument, so the value opened is the value that was checked.
Parameters
Section titled “Parameters”string
The directory the path must stay inside.
string
The path to check.
options?
Section titled “options?”Resolution base, root-equality and case-folding policy.
Returns
Section titled “Returns”Promise<string>
A promise for the real absolute path.
Throws
Section titled “Throws”PathEscapeError If the real path is outside the real root.