Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get PATH environment variable separator in nodejs?

Tags:

node.js

in python i can use

  import os
  os.pathsep ===> ':' for unix, ';' for windows. 

how can i get the same in nodejs?

for now i am asking if platform is win32 or not

 process.platform === 'win32' ? ';' : ':' ;

i want to achieve the same as asked : Python: Platform independent way to modify PATH environment variable but in nodejs.

like image 685
guy mograbi Avatar asked Dec 18 '22 19:12

guy mograbi


1 Answers

var path      = require('path');
var delimiter = path.delimiter;

See also here.

like image 93
robertklep Avatar answered Jan 16 '23 17:01

robertklep