6

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.

2
  • please use os npm for this nodejs.org/api/os.html Commented Feb 25, 2016 at 11:08
  • os.platform() is the function Commented Feb 25, 2016 at 11:08

1 Answer 1

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

See also here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.