1. os-name
Get the name of the current operating system. Example: macOS Sierra
os-name
Package: os-name
Created by: sindresorhus
Last modified: Fri, 24 Nov 2023 16:53:40 GMT
Version: 6.0.0
License: MIT
Downloads: 12,221,938
Repository: https://github.com/sindresorhus/os-name

Install

npm install os-name
yarn add os-name

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';

// On a macOS Sierra system

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

osName(os.platform(), os.release());
//=> 'macOS Sierra'

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.

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

Check out getos if you need the Linux distribution name.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code