Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Node.js path.delimiter Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The path.delimiter property is an inbuilt application programming interface of the path module which is used to get platform-specific path delimiter.

Syntax:

path.delimiter;

Return Value: This property returns a string that represents platform specific path delimiter. The returned value is : for POSIX and ; for Windows.

Below examples illustrate the use of path.delimiter in Node.js:

Example 1:




// Node.js program to demonstrate the   
// path.delimiter property
  
// Allocating path module
const path = require('path');
  
// Printing path.delimiter value
console.log(path.delimiter);

Output:

;

Example 2:




// Node.js program to demonstrate the   
// path.delimiter property
  
// Allocating path module
const path = require('path');
  
// Allocating process module
const process = require('process');
   
// Printing path.delimiter value
var delimiter = path.delimiter;
   
console.log(process.env.PATH);
console.log(process.env.PATH.split(path.delimiter));

Output:

C:\wamp64\bin\php\php7.3.1\ext\ImageMagick;C:\Program Files (x86)\Common 
Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Windows\System32\OpenSSH\;D:\programfiles\Git\cmd;
D:\programfiles\Cmake\bin;
C:\Program
Files\nodejs\;C:\Users\gekcho\AppData\Local\Microsoft\WindowsApps;
C:\Users\gekcho\AppData\Roaming\npm
[ 'C:\\wamp64\\bin\\php\\php7.3.1\\ext\\ImageMagick',
  'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath',
  'C:\\Windows\\system32',
  'C:\\Windows',
  'C:\\Windows\\System32\\Wbem',
  'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\',
  'C:\\Windows\\System32\\OpenSSH\\',
  'D:\\programfiles\\Git\\cmd',
  'D:\\programfiles\\Cmake\\bin',
  'C:\\Program Files\\nodejs\\',
  'C:\\Users\\gekcho\\AppData\\Local\\Microsoft\\WindowsApps',
  'C:\\Users\\gekcho\\AppData\\Roaming\\npm' ]

Note: The above program will compile and run by using the node filename.js command.

Reference: https://nodejs.org/api/path.html#path_path_delimiter

My Personal Notes arrow_drop_up
Last Updated : 11 Oct, 2021
Like Article
Save Article
Similar Reads
Related Tutorials