Path. Delimiter method in node.js
- 2020-03-30 04:33:46
- OfStack
Method description:
Method returns the true path of the platform, multiple times with ":" or ";" Separated.
Grammar:
path.delimiter
Since this method belongs to the path module, you need to introduce the path module (var path= require(" path ")) before using it.
Receiving parameters:
There is no
Example:
//Example on *nix system:
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
in windows Example above:
console.log(process.env.PATH)
// 'C:Windowssystem32;C:Windows;C:Program Filesnodejs'
process.env.PATH.split(path.delimiter)
// returns
['C:Windowssystem32', 'C:Windows', 'C:Program Filesnodejs']