How can I tell (on the server) if I’m running in Windows or Linux.
I’m developing in WIndows but then deploying to Modulus, and need to set some paths differently during testing/development.
thanks
Russell
How can I tell (on the server) if I’m running in Windows or Linux.
I’m developing in WIndows but then deploying to Modulus, and need to set some paths differently during testing/development.
thanks
Russell
process.platform
is probably the easiest.
https://devdocs.io/node/process#process_process_platform
If you dig into the node internals, you can also use os
var platform = os.platform();
if (platform === 'freebsd' || platform === 'linux') {
console.log("You are running linux!");
} else if (platform === 'win32') {
console.log("You are running windows, bummer");
}
EDIT: of course this will only work on the server.
Thanks, I got it working using the package suggested by Rob.