{"name":"bare-os","version":"3.6.2","author":{"name":"Holepunch"},"license":"Apache-2.0","_id":"bare-os@3.6.2","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"homepage":"https://github.com/holepunchto/bare-os#readme","bugs":{"url":"https://github.com/holepunchto/bare-os/issues"},"dist":{"shasum":"b3c4f5ad5e322c0fd0f3c29fc97d19009e2796e5","tarball":"http://registry-npm.ywwl.com/bare-os/download/bare-os-3.6.2.tgz","fileCount":23,"integrity":"sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A==","signatures":[{"sig":"MEYCIQCvfAhhmQfLGr7RxAmv1E/MW5CwgrBp4u0QP2EJnrsHigIhAOFuuEeJOQPwLUpxxOJhN18u59L39S1a+Y5gcOViRi1D","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":779093,"size":220324,"noattachment":false,"key":"/bare-os/-/bare-os-3.6.2.tgz"},"addon":true,"types":"./index.d.ts","engines":{"bare":">=1.14.0"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./errors":"./lib/errors.js","./package":"./package.json","./constants":"./lib/constants.js"},"gitHead":"ef2bdabf4e69cacef589bcc6650a2015e499bdb1","scripts":{"test":"prettier . --check && bare test.js"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"repository":{"url":"git+https://github.com/holepunchto/bare-os.git","type":"git"},"_npmVersion":"11.5.2","description":"Operating system utilities for Javascript","directories":{},"_nodeVersion":"24.2.0","_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.1","prettier":"^3.4.2","cmake-bare":"^1.1.6","prettier-config-standard":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bare-os_3.6.2_1755764219273_0.7928098075553827","host":"s3://npm-registry-packages-npm-production"},"readme":"# bare-os\n\nOperating system utilities for Bare. The API closely follows that of the Node.js `os` module.\n\n```\nnpm i bare-os\n```\n\n## Usage\n\n```js\nconst os = require('bare-os')\n\nconsole.log(os.platform()) // 'darwin', 'linux', 'win32', ...\nconsole.log(os.arch()) // 'arm64', 'x64', ...\nconsole.log(os.homedir())\nconsole.log(os.tmpdir())\nconsole.log(os.hostname())\nconsole.log(os.networkInterfaces())\n```\n\n## API\n\n#### `os.constants`\n\nAn object containing the following properties:\n\n- `signals` - Signal constants such as `SIGTERM` and `SIGKILL`.\n- `errnos` - Error number constants.\n- `priority` - Process priority constants.\n\nThese are also available as a separate module:\n\n```js\nconst constants = require('bare-os/constants')\n```\n\n#### `os.EOL`\n\nThe platform-specific end-of-line marker. `'\\r\\n'` on Windows, `'\\n'` everywhere else.\n\n#### `os.devNull`\n\nThe platform-specific path to the null device. `'\\\\\\\\.\\\\nul'` on Windows, `'/dev/null'` everywhere else.\n\n#### `const p = os.platform()`\n\nReturns the operating system platform as a string. Possible values include `'android'`, `'darwin'`, `'ios'`, `'linux'`, and `'win32'`.\n\n#### `const a = os.arch()`\n\nReturns the CPU architecture as a string. Possible values include `'arm'`, `'arm64'`, `'ia32'`, and `'x64'`.\n\n#### `const t = os.type()`\n\nReturns the operating system name as returned by `uname(3)`.\n\n#### `const v = os.version()`\n\nReturns the operating system version.\n\n#### `const r = os.release()`\n\nReturns the operating system release.\n\n#### `const m = os.machine()`\n\nReturns the machine type as a string.\n\n#### `const p = os.execPath()`\n\nReturns the absolute path of the executable that started the process.\n\n#### `const id = os.pid()`\n\nReturns the process ID.\n\n#### `const id = os.ppid()`\n\nReturns the parent process ID.\n\n#### `const dir = os.cwd()`\n\nReturns the current working directory.\n\n#### `os.chdir(dir)`\n\nChanges the current working directory to `dir`.\n\n#### `const dir = os.tmpdir()`\n\nReturns the operating system's default directory for temporary files.\n\n#### `const dir = os.homedir()`\n\nReturns the home directory of the current user.\n\n#### `const name = os.hostname()`\n\nReturns the hostname of the operating system.\n\n#### `const interfaces = os.networkInterfaces()`\n\nReturns 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 with the following properties:\n\n- `address` - The assigned IPv4 or IPv6 address.\n- `netmask` - The IPv4 or IPv6 network mask.\n- `family` - Either `'IPv4'` or `'IPv6'`.\n- `cidr` - The assigned IPv4 or IPv6 address with the routing prefix in CIDR notation.\n- `mac` - The MAC address of the network interface.\n- `internal` - `true` if the network interface is a loopback or similar interface that is not remotely accessible; otherwise `false`.\n- `scopeid` - The numeric IPv6 scope ID. Only specified when `family` is `'IPv6'`.\n\n#### `os.kill(pid[, signal])`\n\nSends `signal` to the process identified by `pid`. `signal` can be a string or a number. Defaults to `'SIGTERM'`.\n\n#### `const info = os.userInfo([uid])`\n\nReturns information about a current user. The `uid` value defaults to the current effective uid. The returned object has the following properties:\n\n- `uid` - The user ID.\n- `gid` - The group ID.\n- `username` - The username.\n- `homedir` - The home directory.\n- `shell` - The shell, or `null` if unavailable.\n\n#### `const info = os.groupInfo([gid])`\n\nReturns information about a group. The `gid` value defaults to the effective group ID of the calling process. The returned object has the following properties:\n\n- `groupname` - The group name.\n- `gid` - The group ID.\n- `members` - List with the names of group members.\n\n#### `const e = os.endianness()`\n\nReturns `'LE'` on little-endian systems and `'BE'` on big-endian systems.\n\n#### `const n = os.availableParallelism()`\n\nReturns the number of logical CPU cores available to the process.\n\n#### `const usage = os.cpuUsage([previous])`\n\nReturns an object with `user` and `system` properties, each representing CPU time in microseconds. If `previous` is provided, the returned values are relative to it.\n\n#### `const usage = os.threadCpuUsage([previous])`\n\nLike `os.cpuUsage()` but for the current thread only.\n\n#### `const usage = os.resourceUsage()`\n\nReturns an object describing the resource usage of the current process. The returned object has the following properties:\n\n- `userCPUTime` - User CPU time in microseconds.\n- `systemCPUTime` - System CPU time in microseconds.\n- `maxRSS` - Maximum resident set size in bytes.\n- `sharedMemorySize` - Shared memory size.\n- `unsharedDataSize` - Unshared data size.\n- `unsharedStackSize` - Unshared stack size.\n- `minorPageFault` - Minor page faults.\n- `majorPageFault` - Major page faults.\n- `swappedOut` - Swap count.\n- `fsRead` - File system reads.\n- `fsWrite` - File system writes.\n- `ipcSent` - IPC messages sent.\n- `ipcReceived` - IPC messages received.\n- `signalsCount` - Signals received.\n- `voluntaryContextSwitches` - Voluntary context switches.\n- `involuntaryContextSwitches` - Involuntary context switches.\n\n#### `const usage = os.memoryUsage()`\n\nReturns an object describing the memory usage of the process. The returned object has the following properties:\n\n- `rss` - Resident set size in bytes.\n- `heapTotal` - Total heap size in bytes.\n- `heapUsed` - Used heap size in bytes.\n- `external` - Memory usage of C++ objects bound to JavaScript objects.\n\n#### `const bytes = os.freemem()`\n\nReturns the amount of free system memory in bytes.\n\n#### `const bytes = os.totalmem()`\n\nReturns the total amount of system memory in bytes.\n\n#### `const bytes = os.availableMemory()`\n\nReturns an estimate of the amount of memory available for the process in bytes.\n\n#### `const bytes = os.constrainedMemory()`\n\nReturns the amount of memory available to the process under resource constraints, such as cgroups.\n\n#### `const seconds = os.uptime()`\n\nReturns the system uptime in seconds.\n\n#### `const avgs = os.loadavg()`\n\nReturns an array containing the 1, 5, and 15 minute load averages.\n\n#### `const list = os.cpus()`\n\nReturns an array of objects describing each logical CPU core. Each object has the following properties:\n\n- `model` - The CPU model.\n- `speed` - The CPU speed in MHz.\n- `times` - An object with `user`, `nice`, `sys`, `idle`, and `irq` CPU time values in milliseconds.\n\n#### `const title = os.getProcessTitle()`\n\nReturns the current process title.\n\n#### `os.setProcessTitle(title)`\n\nSets the process title. `title` is coerced to a string and must be shorter than 256 characters.\n\n#### `const priority = os.getPriority([pid])`\n\nReturns the scheduling priority of the process specified by `pid`. Defaults to `0`, meaning the current process.\n\n#### `os.setPriority([pid, ]priority)`\n\nSets the scheduling priority of the process specified by `pid`. If `pid` is omitted, the priority of the current process is set.\n\n#### `const keys = os.getEnvKeys()`\n\nReturns an array of the names of all environment variables.\n\n#### `const value = os.getEnv(name)`\n\nReturns the value of the environment variable `name`, or `undefined` if it is not set.\n\n#### `const exists = os.hasEnv(name)`\n\nReturns `true` if the environment variable `name` is set, otherwise `false`.\n\n#### `os.setEnv(name, value)`\n\nSets the environment variable `name` to `value`.\n\n#### `os.unsetEnv(name)`\n\nRemoves the environment variable `name`.\n\n## License\n\nApache-2.0\n","publish_time":1755764219479,"_cnpm_publish_time":1755764219479,"dist-tags":{"latest":"3.9.4"}}