node:os

#Import

import os from "nstdlib/node/os";

Note

The API is available, but not everything works. Answers what is true of the realm and refuses what would describe a machine. hostname() is localhost, uptime() is the realm's own clock, homedir() reads HOME/USERPROFILE, tmpdir() reads TMPDIR/TMP/TEMP, platform/arch/EOL are baked at build time, and networkInterfaces() reports loopback wherever the in-realm socket stack is installed and refuses where it is not. availableParallelism() is navigator.hardwareConcurrency, or 1 where there is no navigator, and cpus() reports that many cores with libuv's own unknown/0 fields. totalmem()/freemem() are the exception and say so: navigator.deviceMemory where a runtime has it, otherwise a 1 GiB placeholder announced once through process.emitWarning. loadavg(), userInfo() and the priority calls still throw ERR_NSTDLIB_NO_BINDING.

#Support

node:os. nstd: some support; Node test suite 12.5% passing. Browser: works; export coverage 100%; Node test suite 12.5% passing.

  • nstd: 1/8 of Node's own eligible tests pass under nstd.
  • Browser: Loads with a minimal process object. 23 of Node's 23 exports are available. 1 of 1 behavior checks match Node.js.

#Exports (23)

Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:

  • ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
  • ⚠️ A value one way, undefined the other.
  • ❔ undefined both ways.
  • ❌ Not exported at all.
  • – Not measured.
ExportNode.jsBrowser
EOL✅✅
arch✅✅
availableParallelism✅✅
constants✅✅
cpus✅✅
devNull✅✅
endianness✅✅
freemem✅✅
getPriority✅✅
homedir✅✅
hostname✅✅
loadavg✅✅
machine✅✅
networkInterfaces✅✅
platform✅✅
release✅✅
setPriority✅✅
tmpdir✅✅
totalmem✅✅
type✅✅
uptime✅✅
userInfo✅✅
version✅✅

#Diagnostics

nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:

  • coverage: 23/23 of the host's export names answer inside host node. API only. Answers what is true of the realm and refuses what would describe a machine. hostname() is localhost, uptime() is the realm's own clock, homedir() reads HOME/USERPROFILE, tmpdir() reads TMPDIR/TMP/TEMP, platform/arch/EOL are baked at build time, and networkInterfaces() reports loopback wherever the in-realm socket stack is installed and refuses where it is not. availableParallelism() is navigator.hardwareConcurrency, or 1 where there is no navigator, and cpus() reports that many cores with libuv's own unknown/0 fields. totalmem()/freemem() are the exception and say so: navigator.deviceMemory where a runtime has it, otherwise a 1 GiB placeholder announced once through process.emitWarning. loadavg(), userInfo() and the priority calls still throw ERR_NSTDLIB_NO_BINDING.
  • smoke: Imports in a clean child process.
  • node-suite: 3/8 of Node's own eligible tests pass with ./dist inside host node. A failure there and in the page is the library's, one only in the page is the engine's.