Skip to main content

Module path

Module path 

Source
Expand description

node:path — POSIX-style pure string operations.

join, resolve, dirname, basename, extname, normalize, relative, isAbsolute, parse, format, toNamespacedPath, sep, delimiter, and posix pointing back at the module. resolve roots at process.cwd() — the sandbox root this runtime reports, not the real process directory. No win32 flavour: this runtime’s path model is POSIX, and a path.win32 that answered POSIX would be worse than an absent one.

Every entry point normalises in a single pass into one String: a path helper is called in a loop by the code above it (a bundler resolving a graph, a test runner naming fixtures), so an intermediate Vec<&str> and a join per call are not free.

Structs§

Cwd
What process.cwd() answers, kept where resolve can read it without calling into JS.

Functions§

path_object
Build the path module object (fresh per call; only built once per session by the module loader).
set_cwd
Record what process.cwd() answers for this realm.