Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2023-02-24 20:18:19
Size: 776
Comment:
Revision 4 as of 2025-12-19 21:09:35
Size: 1024
Comment: Adding description
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Node Path = = Node path =

The '''`path`''' module provides utilities for working with file paths.
Line 9: Line 11:
== BaseName ==

----



== Delimiter ==

----



== DirName ==

----



== ExtName ==

----



== Format ==

----



== IsAbsolute ==

----



== Join ==
== Example ==
Line 50: Line 16:
Line 57: Line 24:
== Normalize == == Constants ==

||'''Constants''' ||'''Description'''||
||`path.delimiter`||OS-specific path delimiter (as for a list of paths)||
||`path.sep` ||OS-specific path separator||
Line 63: Line 34:
== Parse == == Functions ==

||'''Function Name''' ||'''Description'''||
||`path.basename` || ||
||`path.dirname` || ||
||`path.extname` || ||
||`path.format` || ||
||`path.isAbsolute` || ||
||`path.join` || ||
||`path.normalize` || ||
||`path.parse` || ||
||`path.relative` || ||
||`path.resolve` || ||
||`path.toNamespacedPath`|| ||
Line 69: Line 53:
== Posix == == See also ==
Line 71: Line 55:
----



== Relative ==

{{{
const path = require("path");

function relativeDocumentPath(filename) {
  return path.relative(myDocuments, filename);
}
}}}

----



== Resolve ==

----



== Sep ==

----



== ToNamespacedPath ==

----



== Win32 ==
[[https://nodejs.org/api/path.html|Node API for path]]

Node path

The path module provides utilities for working with file paths.


Example

const os = require("os");
const path = require("path");

const myDocuments = path.join(os.homedir(), "Documents");


Constants

Constants

Description

path.delimiter

OS-specific path delimiter (as for a list of paths)

path.sep

OS-specific path separator


Functions

Function Name

Description

path.basename

path.dirname

path.extname

path.format

path.isAbsolute

path.join

path.normalize

path.parse

path.relative

path.resolve

path.toNamespacedPath


See also

Node API for path


CategoryRicottone

Node/Path (last edited 2025-12-19 21:09:35 by DominicRicottone)