Path

path.normalize()

Simplifies separator and dot-segment syntax without resolving links on disk. Tested on Node.js 22.16.0. Normalization does not establish that an untrusted path stays within an authorized directory.

Formal Syntax & Structure

nodejs syntaxnodejs
path.normalize(path)

Parameters & Attributes

NameTypeDescription
pathstringPath text.

Return Value

string

Normalized path.

Working Example

Example Snippetnodejs
import path from 'node:path';console.log(path.posix.normalize('/catalog//2026/../report.csv'));
Node.js Reference