# process

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

- Source: https://titaniumsdk.com/docs/sdk/12.6.3/process
- Titanium SDK version: 12.6.3
- Kind: pseudo
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 8.1.0
- Extends: EventEmitter
- Inheritance: EventEmitter

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 `process` core module.

More details on the Node.js API can be found in their [process module documentation](https://nodejs.org/api/process.html)

Note that this particular shim has many unimplemented, no-op, or unsupported APIs and events.

The `process` object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using `require()`. It can also be explicitly accessed using `require()`:

``` javascript
const process = require('process');
```

## Properties

### arch

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

### argv

- Type: Array<String>
- Platforms: Android, iPhone, iPad, macOS

The `process.argv` property returns an array containing the command-line arguments passed when the Node.js process was launched.
The first element will be `process.execPath`. See [process.argv0](https://titaniumsdk.com/docs/sdk/process.md#argv0) if access to the original value of `argv[0]` is needed.
The second element will be the path to the JavaScript file being executed.
The remaining elements will be any additional command-line arguments.

### argv0

- Type: String
- Platforms: Android, iPhone, iPad, macOS
- Permission: read-only
- Value: `""`

The `process.argv0` property stores a read-only copy of the original value of `argv[0]` passed when Node.js starts.

### channel

- Type: Object
- Platforms: Android, iPhone, iPad, macOS
- Value: `"undefined"`

Always `undefined` in Titanium.

### config

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

Always `{}` in Titanium.

### connected

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Value: `false`

Always `false` in Titanium.

### debugPort

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

The port used by the debugger when enabled.

### env

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

This is an object whose keys are environment variable names and whose values are the related environmnet variable values.

In Titanium, we will pass along environment variables from the system/CLI to the app for `'development'` builds,
*but will not do so for `'production'` builds!*

### execArgv

- Type: Array<String>
- Platforms: Android, iPhone, iPad, macOS

Always `[]` in Titanium.

### execPath

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

Always `''` in Titanium.

### exitCode

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Value: `"undefined"`

Unused in Titanium.

### noDeprecation

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Default: `false`

The `process.noDeprecation` property indicates whether the `--no-deprecation` flag is set on the current Node.js process. See the documentation for the `'warning'` event and the `emitWarning()` method for more information about this flag's behavior.

### pid

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Value: `0`

The `process.pid` property returns the PID of the process. Always returns `0` in Titanium.

### platform

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

Equivalent to [Titanium.Platform.osname](https://titaniumsdk.com/docs/sdk/Titanium.Platform.md#osname)

### ppid

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Value: `0`

The `process.ppid` property returns the PID of the parent of the current process. Always returns `0` in Titanium.

### stderr

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

The `process.stderr` property returns a stream connected to `stderr`.

### stdout

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

The `process.stdout` property returns a stream connected to `stdout`.

### throwDeprecation

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Default: `false`

The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. process.throwDeprecation is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the `'warning'` event and the `emitWarning()` method for more information.

### title

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

Equivalent to [Titanium.App.name](https://titaniumsdk.com/docs/sdk/Titanium.App.md#name)

### traceDeprecation

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Default: `false`

The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the documentation for the `'warning'` event and the `emitWarning()` method for more information about this flag's behavior.

### version

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

Equivalent to [Titanium.version](https://titaniumsdk.com/docs/sdk/Titanium.md#version)

### versions

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

An object containing version information for included dependencies

## Methods

### abort

- Platforms: Android, iPhone, iPad, macOS

No-op on Titanium

### binding

- Platforms: Android, iPhone, iPad, macOS

This is not intended as user-facing API and will throw an `Error` if invoked.

### chdir

- Platforms: Android, iPhone, iPad, macOS

This is unsupported on Titanium and will throw an `Error` if invoked.

### cpuUsage

- Platforms: Android, iPhone, iPad, macOS

Returns a dummy object with `0`-ed out values.

Returns: Object

### cwd

- Platforms: Android, iPhone, iPad, macOS

Returns the value of `__dirname` on Titanium.

Returns: String

### disconnect

- Platforms: Android, iPhone, iPad, macOS

No-op on Titanium

### dlopen

- Platforms: Android, iPhone, iPad, macOS

This is unsupported on Titanium and will throw an `Error` if invoked.

### emitWarning

- Platforms: Android, iPhone, iPad, macOS

The `process.emitWarning()` method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the `'warning'` event.

Parameters:

- `warning` (String | Error): The warning to emit.
- `options` (String | EmitWarningOptions, optional): When `warning` is a `String`, `type` is the name to use for the type of warning being emitted. Default: `Warning`.
- `code` (String, optional): A unique identifier for the warning instance being emitted.
- `ctor` (Function, optional): When `warning` is a `String`, `ctor` is an optional function used to limit the generated stack trace. Default: ``process.emitWarning``.

### exit

- Platforms: Android, iPhone, iPad, macOS

This is unsupported on Titanium and will throw an `Error` if invoked.

### umask

- Platforms: Android, iPhone, iPad, macOS

No-op on Titanium. Will always return `0`.

Returns: Number

### uptime

- Platforms: Android, iPhone, iPad, macOS

The `process.uptime()` method returns the number of seconds the current Node.js process has been running.

The return value includes fractions of a second. Use `Math.floor()` to get whole seconds.

Returns: Number

## Events

### uncaughtException

- Platforms: Android, iPhone, iPad, macOS

The `'uncaughtException'` event is emitted when an uncaught JavaScript exception bubbles all the way back to the event loop.

Event properties:

- `err` (Error): The uncaught exception.

### warning

- Platforms: Android, iPhone, iPad, macOS

The `'warning'` event is emitted whenever Node.js emits a `process` warning.

Event properties:

- `warning` (Error): The warning thrown.

## Inherited members

17 members are inherited. Each is documented on the type that declares it.

- [EventEmitter](https://titaniumsdk.com/docs/sdk/12.6.3/EventEmitter.md): `addListener`, `emit`, `eventNames`, `getMaxListeners`, `listenerCount`, `listeners`, `newListener`, `off`, `on`, `once`, `prependListener`, `prependOnceListener`, `rawListeners`, `removeAllListeners`, `removeListener`, `removeListener`, `setMaxListeners`

---

- 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`.

