os-name
Get the name of the current operating system. Example: macOS Sierra
Last updated 2 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install os-name 
SYNC missed versions from official npm registry.

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 osName from 'os-name';

// On a macOS Sierra system

osName();
//=> 'macOS Sierra'

// On an Ubuntu system

osName();
//=> 'Ubuntu 20.04.1 LTS'

osName('darwin', '14.0.0');
//=> 'OS X Yosemite'

osName('linux', '3.13.0-24-generic');
//=> 'Linux 3.13'

osName('win32', '6.3.9600');
//=> 'Windows 8.1'

API

osName(platform?, release?)

By default, the name of the current operating system is returned.

On Linux, it reads the pretty name from /etc/os-release when available (e.g., 'Ubuntu 20.04.1 LTS', 'Debian GNU/Linux 12 (bookworm)'). When a custom release is provided, it falls back to 'Linux <version>'.

You can optionally supply a custom os.platform() and os.release().

Related

Current Tags

  • 7.0.0                                ...           latest (2 months ago)

19 Versions

  • 7.0.0                                ...           2 months ago
  • 6.1.0                                ...           a year ago
  • 6.0.0                                ...           2 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.1                                ...           5 years ago
  • 4.0.0                                ...           6 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.1                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.3                                ...           11 years ago
  • 1.0.2                                ...           11 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 2
This Week 86
This Month 121
Last Day 15
Last Week 57
Last Month 331
Dependencies (2)
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |