@robinpath/os
0.1.2Node.jsPublicSystem information: hostname, platform, architecture, CPU, memory, network, and more
OS
System information: hostname, platform, architecture, CPU, memory, network, and more
Package: @robinpath/os | Category: Other | Type: Utility
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the os module when you need to:
- Get the system hostname -- Use
os.hostnameto perform this operation - Get the OS platform (linux, darwin, win32) -- Use
os.platformto perform this operation - Get the CPU architecture -- Use
os.archto perform this operation - Get CPU information -- Use
os.cpusto perform this operation - Get the number of CPU cores -- Use
os.cpuCountto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
hostname | Get the system hostname | Hostname |
platform | Get the OS platform (linux, darwin, win32) | Platform string |
arch | Get the CPU architecture | Architecture (x64, arm64, etc.) |
cpus | Get CPU information | Array of {model, speed} objects |
cpuCount | Get the number of CPU cores | Number of CPUs |
totalmem | Get total system memory in bytes | Total memory in bytes |
freemem | Get free system memory in bytes | Free memory in bytes |
uptime | Get system uptime in seconds | Uptime in seconds |
homedir | Get the user home directory | Home directory path |
tmpdir | Get the OS temp directory | Temp directory path |
userInfo | Get current user information | {username, homedir, shell} |
networkInterfaces | Get network interface information | Object of interface arrays |
type | Get the OS type (Linux, Darwin, Windows_NT) | OS type string |
release | Get the OS release version | OS release string |
eol | Get the OS end-of-line marker | EOL string (\n or \r\n) |
Functions
hostname
Get the system hostname
Module: os | Returns: string -- Hostname
os.hostname
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
platform
Get the OS platform (linux, darwin, win32)
Module: os | Returns: string -- Platform string
os.platform
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
arch
Get the CPU architecture
Module: os | Returns: string -- Architecture (x64, arm64, etc.)
os.arch
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
cpus
Get CPU information
Module: os | Returns: array -- Array of {model, speed} objects
os.cpus
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
cpuCount
Get the number of CPU cores
Module: os | Returns: number -- Number of CPUs
os.cpuCount
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
totalmem
Get total system memory in bytes
Module: os | Returns: number -- Total memory in bytes
os.totalmem
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
freemem
Get free system memory in bytes
Module: os | Returns: number -- Free memory in bytes
os.freemem
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
uptime
Get system uptime in seconds
Module: os | Returns: number -- Uptime in seconds
os.uptime
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
homedir
Get the user home directory
Module: os | Returns: string -- Home directory path
os.homedir
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
tmpdir
Get the OS temp directory
Module: os | Returns: string -- Temp directory path
os.tmpdir
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
userInfo
Get current user information
Module: os | Returns: object -- {username, homedir, shell}
os.userInfo
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
networkInterfaces
Get network interface information
Module: os | Returns: object -- Object of interface arrays
os.networkInterfaces
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
type
Get the OS type (Linux, Darwin, Windows_NT)
Module: os | Returns: string -- OS type string
os.type
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
release
Get the OS release version
Module: os | Returns: string -- OS release string
os.release
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
eol
Get the OS end-of-line marker
Module: os | Returns: string -- EOL string (\n or \r\n)
os.eol
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | No | Call with no arguments |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Hostname and validate result"
do
set $result as os.hostname
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Multi-step OS workflow
Chain multiple os operations together.
@desc "Hostname, platform, and more"
do
set $r_hostname as os.hostname
set $r_platform as os.platform
set $r_arch as os.arch
print "All operations complete"
enddo
2. Safe hostname with validation
Check results before proceeding.
@desc "Hostname and validate result"
do
set $result as os.hostname
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.2 | latest | 1 months ago |
Related Modules
@robinpathv0.1.4
SMTP email sending and address parsing for RobinPath
hash
JS@robinpathv0.1.3
Cryptographic hashing utilities: MD5, SHA family, HMAC, CRC32, file hashing, UUID v5 generation, secure random bytes, and content fingerprinting
csv
JS@robinpathv0.1.2
Parse and stringify CSV data
apollo
JS@robinpathv0.1.2
Apollo module for RobinPath.
$ robinpath add @robinpath/os
