os
The os namespace provides operating system-related utility methods and properties.
Functions
os.hostname()
Returns the hostname of the operating system.
Returns: String
os.platform()
Returns the operating system platform.
Returns: String — One of: HMI, android, ios, windows.
os.networkInterfaces()
Returns network interfaces that have been assigned a network address.
Returns: Object — Each key is a network interface name; the value is an array of AssignedNetworkAddress objects.
Example
js
{
lo: [
{
address: '127.0.0.1',
netmask: '255.0.0.0',
family: 'IPv4',
mac: '00:00:00:00:00:00',
internal: true,
cidr: '127.0.0.1/8'
}
],
eth0: [
{
address: '192.168.1.108',
netmask: '255.255.255.0',
family: 'IPv4',
mac: '01:02:03:0a:0b:0c',
internal: false,
cidr: '192.168.1.108/24'
}
]
}Types
AssignedNetworkAddress
| Property | Type | Description |
|---|---|---|
address | String | The assigned IPv4 or IPv6 address. |
netmask | String | The IPv4 or IPv6 network mask. |
family | String | IPv4 or IPv6. |
mac | String | The MAC address of the network interface. |
internal | Boolean | true if the interface is a loopback or similar non-remotely-accessible interface. |
scopeid | Number | Numeric IPv6 scope ID (only present when family is IPv6). |
cidr | String | The assigned address with routing prefix in CIDR notation. null if the netmask is invalid. |