Skip to content
Titanium SDK
Version13.0.1

You are reading 13.0.1. See this page in 13.4.1.

os

pseudoAndroidiPhoneiPadmacOSsince 8.1.0

A Node.js-compatible implementation of the core os module

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

Properties 2

constants

os.constants

Contains commonly used operating system-specific constants for error codes, process signals, and so on.

EOL

String

The operating system-specific end-of-line marker.

\n on POSIX \r\n on Windows

Methods 17

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 process.arch. Relates strongly to Titanium.Platform.architecture.

Returns String

Returns an array of objects containing information about each logical CPU core.

Returns Array<CPUInfo>

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 Titanium.Codec.getNativeByteOrder() on Titanium.

Returns String

Returns the amount of free system memory in bytes as an integer.

Returns Number

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
ParametersTypeDescription
pid?Number

The process ID to retrieve scheduling priority for.

Returns Number

Returns an array containing the 1, 5, and 15 minute load averages.

On Titanium, the return value is always [0, 0, 0].

Returns Array<Number>

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 Object

Returns a string identifying the operating system platform. Possible values are 'android', 'iphone', 'ipad', 'windowsphone', and 'windowsstore'.

The return value is equivalent to process.platform.

On Titanium, this is equivalent to Titanium.Platform.osname.

Returns String

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
ParametersTypeDescription
pid?Number

The process ID to set scheduling priority for.

priorityNumber

The scheduling priority to assign to the process.

Returns the operating system as a string.

On Titanium, this returns 'Darwin' for iOS, or 'Linux' for Android. May return 'Unknown' for others.

Returns String

Returns information about the currently effective user.

Parameters
ParametersTypeDescription
options?EncodingOptions

Simple object with encoding property. Ignored on Titanium.

1 field
encoding? String

Character encoding used to interpret resulting strings. If encoding is set to 'buffer' the username, shell, and homedir values will be Buffer instances.

Returns OSUserInfo