# os
A Node.js-compatible implementation of the core os
module
NOTE
This is an abstract type. Any object of this structure can be used where this type is used.
# Overview
Titanium provides a number of shims and ports of core Node.js module functionality.
This module is intended to provide a Node-compatible port of the os
core module.
More details on the Node.js API can be found in their os module documentation (opens new window)
# Properties
# constants
Contains commonly used operating system-specific constants for error codes, process signals, and so on.
# Methods
# arch
Returns the operating system CPU architecture for which the binary was compiled. Possible values are return 'arm'
, 'arm64'
, 'ia32'
, 'x64'
, 'mips'
, and 'unknown'
.
The return value is equivalent to arch. Relates strongly to architecture.
Returns
- Type
- String
# cpus
Returns an array of objects containing information about each logical CPU core.
Returns
- Type
- Array<CPUInfo>
# endianness
Returns a string identifying the endianness of the CPU for which the binary was compiled.
Possible values are 'BE'
for big endian and 'LE'
for little endian.
Related to getNativeByteOrder() on Titanium.
Returns
- Type
- String
# freemem
Returns the amount of free system memory in bytes as an integer.
Returns
- Type
- Number
# getPriority
Returns the scheduling priority for the process specified by pid
. If pid
is not provided or is 0
, the priority of the current process is returned.
Titanium's shim, will always return 0
.
Parameters
Name | Type | Description |
---|---|---|
pid | Number | The process ID to retrieve scheduling priority for. |
Returns
- Type
- Number
# homedir
Returns the string path of the current user's home directory.
On Titanium, returns the same value as applicationDataDirectory.
Returns
- Type
- String
# hostname
Returns the host name of the operating system as a string. On Titanium, this will return the value of address
Returns
- Type
- String
# loadavg
Returns an array containing the 1, 5, and 15 minute load averages.
On Titanium, the return value is always [0, 0, 0]
.
Returns
- Type
- Array<Number>
# networkInterfaces
Returns an object containing network interfaces that have been assigned a network address.
Each key on the returned object identifies a network interface. The associated value is an array of objects that each describe an assigned network address.
On Titanium, an empty object ({}
) is always returned.
Returns
- Type
- Object
# platform
Returns a string identifying the operating system platform. Possible values are 'android'
, 'iphone'
, 'ipad'
, 'windowsphone'
, and 'windowsstore'
.
The return value is equivalent to platform.
On Titanium, this is equivalent to osname.
Returns
- Type
- String
# release
Returns the operating system as a string.
On Titanium, this is equivalent to version.
Returns
- Type
- String
# setPriority
Attempts to set the scheduling priority for the process specified by pid
. If pid
is not provided or is 0
, the process ID of the current process is used.
On Titanium, this method is a no-op.
Parameters
Name | Type | Description |
---|---|---|
pid | Number | The process ID to set scheduling priority for. |
priority | Number | The scheduling priority to assign to the process. |
Returns
- Type
- void
# tmpdir
Returns the operating system's default directory for temporary files as a string.
On Titanium, this is equivalent to tempDirectory.
Returns
- Type
- String
# totalmem
Returns the total amount of system memory in bytes as an integer.
On Titanium, this is equivalent to <Ti.Platform.totalMemory>.
Returns
- Type
- Number
# type
Returns the operating system as a string.
On Titanium, this returns 'Darwin'
for iOS, or 'Linux'
for Android. May return 'Unknown'
for others.
Returns
- Type
- String
# uptime
Returns the system uptime in number of seconds.
On Titanium, this is equivalent to uptime.
Returns
- Type
- Number
# userInfo
Returns information about the currently effective user.
Parameters
Name | Type | Description |
---|---|---|
options | EncodingOptions | Simple object with |
Returns
- Type
- OSUserInfo