Skip to content

PathWithinOptions

PathWithinOptions = object

Defined in: packages/node/src/fs/path-within.ts:7

readonly optional allowRoot?: boolean | null

Defined in: packages/node/src/fs/path-within.ts:22

Whether the path resolving to the root itself counts as within. Default true.

Set it to false where the root is a container the path must be an entry of — a destination directory that must not be overwritten by the write it is receiving.


readonly optional caseInsensitive?: boolean | null

Defined in: packages/node/src/fs/path-within.ts:36

Compares segments case-insensitively. Defaults to true on Windows and false everywhere else.

That default follows the platform’s convention, not the filesystem’s actual behaviour, which Node cannot report: a macOS volume is usually case-insensitive, a case-sensitive one can be mounted anywhere, and NTFS can be made case-sensitive per directory. Where the answer is a security decision and the volume may be case-insensitive, pass true explicitly — comparing case-sensitively there lets /Root/../etc reached as /ROOT/../etc read as a different root.


readonly optional from?: string | null

Defined in: packages/node/src/fs/path-within.ts:12

Directory a relative root or path resolves against. Default process.cwd().