lhl 6ff0e96ad3 8-4-1 | 1 år sedan | |
---|---|---|
.. | ||
cli.js | 1 år sedan | |
index.js | 1 år sedan | |
package.json | 1 år sedan | |
readme.md | 1 år sedan |
Get the name of the current operating system. Example:
OS X Mavericks
Useful for analytics and debugging.
$ npm install --save os-name
var os = require('os');
var osName = require('os-name');
// on an OS X Mavericks system
osName();
//=> OS X Mavericks
osName(os.platform(), os.release());
//=> OS X Mavericks
osName(os.platform());
//=> OS X
osName('linux', '3.13.0-24-generic');
//=> Linux 3.13
osName('win32', '6.3.9600');
//=> Windows 8.1
osName('win32');
// Windows
By default the name of the current operating system is returned.
You can optionally supply a custom os.platform()
and os.release()
.
Check out getos if you need the Linux distribution name.
$ npm install --global os-name
$ os-name --help
Example
os-name
OS X Mavericks
Production systems depend on this package for logging / tracking. Please be careful when introducing new output, and adhere to existing output format (whitespace, capitalization, etc.).
MIT © Sindre Sorhus