# os

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

- Source: https://titaniumsdk.com/docs/sdk/13.1.1/os
- Titanium SDK version: 13.1.1
- Kind: pseudo
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 8.1.0

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](https://nodejs.org/api/os.html)

## Properties

### constants

- Type: os.constants
- Platforms: Android, iPhone, iPad, macOS

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

### EOL

- Type: String
- Platforms: Android, iPhone, iPad, macOS

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

`\n` on POSIX
`\r\n` on Windows

## Methods

### arch

- Platforms: Android, iPhone, iPad, macOS

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](https://titaniumsdk.com/docs/sdk/process.md#arch). Relates strongly to [Titanium.Platform.architecture](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#architecture).

Returns: String

### cpus

- Platforms: Android, iPhone, iPad, macOS

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

Returns: Array<CPUInfo>

### endianness

- Platforms: Android, iPhone, iPad, macOS

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](https://titaniumsdk.com/docs/sdk/Titanium.Codec.md#getNativeByteOrder)() on Titanium.

Returns: String

### freemem

- Platforms: Android, iPhone, iPad, macOS

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

Returns: Number

### getPriority

- Platforms: Android, iPhone, iPad, macOS

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:

- `pid` (Number, optional): The process ID to retrieve scheduling priority for. Default: `0`.

Returns: Number

### homedir

- Platforms: Android, iPhone, iPad, macOS

Returns the string path of the current user's home directory.

On Titanium, returns the same value as [Titanium.Filesystem.applicationDataDirectory](https://titaniumsdk.com/docs/sdk/Titanium.Filesystem.md#applicationDataDirectory).

Returns: String

### hostname

- Platforms: Android, iPhone, iPad, macOS

Returns the host name of the operating system as a string. On Titanium, this will return the value of [Titanium.Platform.address](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#address)

Returns: String

### loadavg

- Platforms: Android, iPhone, iPad, macOS

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>

### networkInterfaces

- Platforms: Android, iPhone, iPad, macOS

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

### platform

- Platforms: Android, iPhone, iPad, macOS

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](https://titaniumsdk.com/docs/sdk/process.md#platform).

On Titanium, this is equivalent to [Titanium.Platform.osname](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#osname).

Returns: String

### release

- Platforms: Android, iPhone, iPad, macOS

Returns the operating system as a string.

On Titanium, this is equivalent to [Titanium.Platform.version](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#version).

Returns: String

### setPriority

- Platforms: Android, iPhone, iPad, macOS

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:

- `pid` (Number, optional): The process ID to set scheduling priority for. Default: `0`.
- `priority` (Number): The scheduling priority to assign to the process.

### tmpdir

- Platforms: Android, iPhone, iPad, macOS

Returns the operating system's default directory for temporary files as a string.

On Titanium, this is equivalent to [Titanium.Filesystem.tempDirectory](https://titaniumsdk.com/docs/sdk/Titanium.Filesystem.md#tempDirectory).

Returns: String

### totalmem

- Platforms: Android, iPhone, iPad, macOS

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

On Titanium, this is equivalent to [Ti.Platform.totalMemory](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#totalMemory).

Returns: Number

### type

- Platforms: Android, iPhone, iPad, macOS

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

### uptime

- Platforms: Android, iPhone, iPad, macOS

Returns the system uptime in number of seconds.

On Titanium, this is equivalent to [Titanium.Platform.uptime](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#uptime).

Returns: Number

### userInfo

- Platforms: Android, iPhone, iPad, macOS

Returns information about the currently effective user.

Parameters:

- `options` (EncodingOptions, optional): Simple object with `encoding` property. Ignored on Titanium.

Returns: OSUserInfo

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

