os-name
Get the name of the current operating system
Example: macOS Sierra
Useful for analytics and debugging.
Install
npm install os-name
Usage
import os from 'node:os';
import osName from 'os-name';
osName();
osName(os.platform(), os.release());
osName('darwin', '14.0.0');
osName('linux', '3.13.0-24-generic');
osName('win32', '6.3.9600');
API
osName(platform?, release?)
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.
Contributing
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.).
Related