Module

Node.OS

Package
purescript-node-os
Repository
purescript-node/purescript-node-os

#eol Source

eol :: String

The operating system-specific end-of-line marker. \n on POSIX \r\n on Windows

#arch Source

arch :: Effect Arch

Returns the operating system CPU architecture for which the Node.js binary was compiled.

#constants Source

constants :: Object Foreign

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

  • constants.signals
  • constants.errno
  • constants.dlopen
  • constants.priority
  • constants.UV_UDP_REUSEADDR

#CPU Source

type CPU = { model :: String, speed :: Int, times :: { idle :: Milliseconds, irq :: Milliseconds, nice :: Milliseconds, sys :: Milliseconds, user :: Milliseconds } }

#cpus Source

cpus :: Effect (Array CPU)

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

#devNull Source

devNull :: String

The platform-specific file path of the null device. \\.\nul on Windows /dev/null on POSIX

#endianness Source

endianness :: Effect Endianness

Identifies the endianness of the CPU for which the Node.js binary was compiled.

#freemem Source

freemem :: Effect Int

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

#getCurrentProcessPriority Source

getCurrentProcessPriority :: Effect Int

Returns the scheduling priority for the current process.

#getPriority Source

getPriority :: Pid -> Effect Int

Returns the scheduling priority for the process specified by pid.

#homedir Source

homedir :: Effect String

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

#hostname Source

hostname :: Effect String

Returns the host name of the operating system as a string.

#LoadAvg Source

type LoadAvg = { fifteen :: Number, five :: Number, one :: Number }

Each label indicates the number of minutes for the load average.

#loadavg Source

loadavg :: Effect LoadAvg

The load average is a measure of system activity calculated by the operating system and expressed as a fractional number. The load average is a Unix-specific concept. On Windows, the return value is always { one: 0, five: 0, fifteen: 0 }.

#NetworkInterface Source

type NetworkInterface = { address :: String, cidr :: Maybe String, family :: IpVersion, internal :: Boolean, mac :: String, netmask :: String, scopeId :: Maybe Int }
  • address - The assigned IPv4 or IPv6 address
  • netmask - The IPv4 or IPv6 network mask
  • mac - The MAC address of the network interface
  • internal - true if the network interface is a loopback or similar interface that is not remotely accessible; otherwise false

Conditional fields:

  • cidr - The assigned IPv4 or IPv6 address with the routing prefix in CIDR notation. If the netmask is invalid, this property is set to null.
  • scopeid - The numeric IPv6 scope ID (only specified when family is IPv6)

#networkInterfaces Source

networkInterfaces :: Effect (Object (Array NetworkInterface))

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.

#release Source

release :: Effect String

Returns the operating system as a string.

#setCurrentProcessPriority Source

setCurrentProcessPriority :: Int -> Effect Unit

See setPriority.

#setPriority Source

setPriority :: Pid -> Int -> Effect Unit

Attempts to set the scheduling priority for the process specified by pid. Note: all inputs are clamped to a valid value (i.e. -20 = high priority and 19 = low priority).

Due to differences between Unix priority levels and Windows priority classes, priority is mapped to one of six priority constants in os.constants.priority. When retrieving a process priority level, this range mapping may cause the return value to be slightly different on Windows. To avoid confusion, set priority to one of the priority constants.

On Windows, setting priority to PRIORITY_HIGHEST requires elevated user privileges. Otherwise the set priority will be silently reduced to PRIORITY_HIGH.

#tmpdir Source

tmpdir :: Effect String

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

#totalmem Source

totalmem :: Effect Int

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

#type_ Source

type_ :: Effect String

Returns the operating system name as returned by uname(3). For example, it returns 'Linux' on Linux, 'Darwin' on macOS, and 'Windows_NT' on Windows.

#uptime Source

uptime :: Effect Number

Returns the system uptime in number of seconds.

#UserInfo Source

type UserInfo a = { gid :: Int, homedir :: a, shell :: Maybe a, uid :: Int, username :: a }

a is either String or ImmutableBuffer

#userInfo Source

userInfo :: Effect (UserInfo String)

Returns information about the currently effective user.

  • On POSIX platforms, this is typically a subset of the password file. The returned object includes the username, uid, gid, shell, and homedir.
  • On Windows, the uid and gid fields are -1, and shell is null.

Note: The value of homedir returned here is provided by the operating system. This differs from the result of os.homedir(), which queries environment variables for the home directory before falling back to the operating system response.

Note: This can throw a SystemError. If that's relevant to you, use userInfoSE and friends.

#userInfoSE Source

userInfoSE :: Effect (Either SystemError (UserInfo String))

A variant of userInfo that catches the thrown SystemError when username or homedir are undefined for the given user.

#version Source

version :: Effect String

Returns a string identifying the kernel version.