How can I access my OS from the node shell?
Context: I’m writing a script in node that I want to open a file with the default program, and the commands for doing this vary across OS.
I’ve tried standard javascript ways of getting the OS, but they haven’t worked (for obvious reasons, there is no navigator in node).
Is it possible to do this without installing nonstandard modules?
warning: this might be outdated
there is no
navigatorobject in node.js, because it does not run in the browser. it runs in the system. “equivalent” to navigator isprocess. this object holds many information, e.g.if you want to run a web browser, you have to execute it..
this might not work in newer node.js versions (i have 2.x), you might have to use
i guess there is no simple way how to multiplatform “run” any file with its “default app”, you would have to find out how to do it in each OS / desktop environment, and do it after OS detection.