diff --git a/doc/api/path.md b/doc/api/path.md index d9452b00dbfd48..cb0afd9f713658 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -318,8 +318,9 @@ The `path.normalize()` method normalizes the given `path`, resolving `'..'` and `'.'` segments. When multiple, sequential path segment separation characters are found (e.g. -`/` on POSIX and `\` on Windows), they are replaced by a single instance of the -platform specific path segment separator. Trailing separators are preserved. +`/` on POSIX and either `\` or `/` on Windows), they are replaced by a single +instance of the platform specific path segment separator (`/` on POSIX and +`\` on Windows). Trailing separators are preserved. If the `path` is a zero-length string, `'.'` is returned, representing the current working directory. @@ -338,6 +339,14 @@ path.normalize('C:\\temp\\\\foo\\bar\\..\\'); // Returns: 'C:\\temp\\foo\\' ``` +Since Windows recognizes multiple path separators, both separators will be +replaced by instances of the Windows preferred separator (`\`): + +```js +path.win32.normalize("C:////temp\\\\/\\/\\\/foo/bar") +// Returns: 'C:\\temp\\foo\\bar' +``` + A [`TypeError`][] is thrown if `path` is not a string. ## path.parse(path)