bare-os
Reference for bare-os: operating-system utilities for Bare—platform and CPU info, directories, memory and load, process priority, and environment access.
bare-os provides operating-system utilities for Bare. The API follows the Node.js os module, with extra helpers for the current process and environment. It's a native addon and requires Bare >=1.14.0. Many bare-* modules depend on it.
npm i bare-osUsage
const os = require('bare-os')
console.log(os.platform(), os.arch())
console.log('home:', os.homedir())
console.log('cpus:', os.cpus().length)API
Constants
os.constants · os.EOL · os.devNull
OS constant tables, the end-of-line marker, and the null-device path.
Platform & machine
os.platform() · os.arch() · os.type() · os.version() · os.release() · os.machine() · os.endianness()
Identify the operating system, architecture, kernel, and byte order.
os.hostname() · os.networkInterfaces() · os.availableParallelism()
Host name, network interfaces, and the number of parallel units of execution.
Directories
os.cwd() · os.chdir(dir) · os.tmpdir() · os.homedir() · os.execPath()
Get or change the working directory, and resolve the temp, home, and executable paths.
Process & users
os.pid() · os.ppid() · os.kill(pid[, signal])
Process IDs, and signal delivery.
const info = os.userInfo([uid]) · os.groupInfo([gid])
User and group information.
os.getProcessTitle() · os.setProcessTitle(title) · os.getPriority([pid]) · os.setPriority([pid, ]priority)
Read or set the process title and scheduling priority.
Resources
os.cpus() · os.cpuUsage([previous]) · os.threadCpuUsage([previous]) · os.resourceUsage() · os.loadavg() · os.uptime()
CPU topology, CPU-time and resource accounting, load averages, and uptime.
os.memoryUsage() · os.freemem() · os.totalmem() · os.availableMemory() · os.constrainedMemory()
Process and system memory figures.
Environment
os.getEnvKeys() · os.getEnv(name) · os.hasEnv(name) · os.setEnv(name, value) · os.unsetEnv(name)
Direct access to environment variables. The higher-level bare-env wraps these into a process.env-style object.
See also
- Bare modules—the full
bare-*catalog. bare-subprocess—spawn processes that build on this module.- Bare runtime API—
Bare.platformandBare.archfor compile-time identifiers.