infinity.os¶
Provides information about the operating system, the processor architecture and the memory of the system, on which the INFINITY.JS instance is being run, as well as access to environment variables.
Module: none (built-in)
- processorCount
- hostName
- architecture
- architectureName
- build
- major
- memoryFree
- memoryTotal
- minor
- name
- platform
- platformName
- processMemory
- uptime
processorCount¶
Type: number
Gets the amount of logical processors on the current system.
hostName¶
Type: string
Gets the hostname of the current operating system.
architecture¶
Type: infinity.os.architectures
Gets the processor architecture identifier, which the current operating system is running on, according to infinity.os.architectures enums.
architectureName¶
Type: string
Gets the name of the processor architecture: 'IntelX86', 'IntelX64', 'ARM32' or 'ARM64' (undefined for an unknown architecture).
build¶
Type: number
Gets the build number of the current operating system.
major¶
Type: number
Gets the major release number of the current operating system.
memoryFree¶
Type: number
Gets the physical memory in bytes that is available for new processes (Windows: available physical memory, Linux: MemAvailable of /proc/meminfo). Returns -1 if the value cannot be determined. Since 3.10.174.
memoryTotal¶
Type: number
Gets the total physical memory of the system in bytes (Windows: total physical memory, Linux: MemTotal of /proc/meminfo). Returns -1 if the value cannot be determined. Since 3.10.174.
minor¶
Type: number
Gets the minor release number of the current operating system.
name¶
Type: string
Gets the name of the current operating system.
platform¶
Type: infinity.os.platforms
Gets the general platform identifier of the current operating system, according to infinity.os.platforms enums.
Example:
if (infinity.os.platform === infinity.os.platforms.linux) {
console.info('Running on Linux');
}
platformName¶
Type: string
Gets the name of the platform: 'Windows', 'MacOS', 'iOS', 'Android', 'WinRT' or 'Linux' (undefined for an unknown platform).
processMemory¶
Type: number
Gets the memory currently used by the INFINITY.JS process in bytes (resident memory: Windows working set, Linux VmRSS of /proc/self/status). Returns -1 if the value cannot be determined. Since 3.10.174.
uptime¶
Type: number
Gets the number of whole seconds since the system has been started. Returns -1 if the value cannot be determined. Since 3.10.174.
Example:
console.info('Memory: ' + Math.round(infinity.os.processMemory / 1048576) + ' MB used by this process, ' +
Math.round(infinity.os.memoryFree / 1048576) + ' of ' + Math.round(infinity.os.memoryTotal / 1048576) + ' MB available');
console.info('System uptime: ' + Math.floor(infinity.os.uptime / 3600) + ' hours');
environment()¶
Returns the value of an environment variable of the INFINITY.JS process. Since 3.10.174.
Signature:
environment( name: string ): string
Parameters:
- name:
stringThe name of the environment variable.
Return type: string
Returns an empty string if the variable is not set.
Example:
let home = infinity.os.environment(infinity.os.platform === infinity.os.platforms.windows ? 'USERPROFILE' : 'HOME');
infinity.os.architectures¶
Values:
-
intelX86:
0Stands for the x86 processor architecture family.
-
intelX64:
1Stands for the x64 processor architecture family.
-
arm32:
2Stands for the 32-bit ARM processor architecture family.
-
arm64:
3Stands for the 64-bit ARM processor architecture family.
Example:
let isX64 = (infinity.os.architecture === infinity.os.architectures.intelX64);
infinity.os.platforms¶
Values:
-
windows:
0Stands for the Microsoft Windows operating systems platform.
-
macOS:
1Stands for the Apple macOS operating systems platform.
-
iOS:
2Stands for the Apple iOS operating systems platform.
-
android:
3Stands for the Google Android operating systems platform.
-
winRt:
4Stands for the Microsoft Windows Runtime operating systems platform.
-
linux:
5Stands for the Linux operating systems platform. Note: before version 3.10.174 this constant had the wrong value
2, althoughinfinity.os.platformreturns5under Linux.
Example:
let isWindows = (infinity.os.platform === infinity.os.platforms.windows);