Innovenergy_trunk/frontend/node_modules/get-os-info
Kim 085d7c68ba adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
..
lib adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
README.md adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
package.json adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00

README.md

get-os-info

Get the name and version of the local OS

This package is based on the macos-release , windows-release and getos packages.

Install

$ npm install get-os-info

Usage

TypeScript

import getOSInfo, { OSInfo } from 'get-os-info'

const info: OSInfo | null = await getOSInfo();

if (info)
    console.log(info.name, info.version)

// Example:
// {
//   name: 'Windows',
//   version: '11'
// }

JavaScript

import { getOSInfo } from 'get-os-info';
//or
const { getOSInfo } = require('get-os-info');

const info = await getOSInfo();

Separate functions

import os from 'os'
import { getMacInfo, getWindowsInfo, getLinuxInfo } from "get-os-info";
//or
const os = require("os");
const { getMacInfo, getWindowsInfo, getLinuxInfo } = require('get-os-info')

const release = os.release(); //'10.0.22000'

getWindowsInfo(release).then(info => {
    if (info)
        console.log(info);
})
// {
//   name:    'Windows',
//   version: '11'
// }

console.log(await getWindowsInfo()) // Will be the same

NOTE: Currently it is not possible to pass a release version argument to the getLinuxInfo function.