What is windows-release?
The windows-release npm package is used to get the name of a Windows version from the release number. This can be particularly useful for applications that need to display or log the Windows version in a human-readable format.
What are windows-release's main functionalities?
Get Windows Version Name
This feature allows you to get the name of the Windows version based on the release number. By default, it uses the current operating system's release number.
const windowsRelease = require('windows-release');
console.log(windowsRelease()); // e.g., '10' for Windows 10
Get Windows Version Name from Specific Release Number
This feature allows you to get the name of the Windows version from a specific release number. This can be useful for parsing and displaying version information from logs or other data sources.
const windowsRelease = require('windows-release');
console.log(windowsRelease('10.0.19041')); // '10' for Windows 10
Other packages similar to windows-release
os-name
The os-name package provides a more general solution for getting the name of the operating system, including Windows, macOS, and Linux. It offers broader functionality compared to windows-release, which is specific to Windows.
os-release
The os-release package is another alternative that provides information about the operating system release. It is more focused on Linux distributions but can be used in conjunction with other tools to get similar information for Windows.
windows-release
Get the name of a Windows version from the release number: 5.1.2600
→ XP
Install
npm install windows-release
Usage
import os from 'node:os';
import windowsRelease from 'windows-release';
windowsRelease();
os.release();
windowsRelease(os.release());
windowsRelease('4.9.3000');
API
windowsRelease(release?)
release
Type: string
By default, the current OS is used, but you can supply a custom release number, which is the output of os.release()
.
Note: Most Windows Server versions cannot be detected based on the release number alone. There is runtime detection in place to work around this, but it will only be used if no argument is supplied, or the supplied argument matches os.release()
.
Related
- os-name - Get the name of the current operating system
- macos-release - Get the name and version of a macOS release from the Darwin version