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
- nstd: 1/8 of Node's own eligible tests pass under nstd.
- Browser: Loads with a minimal
processobject. 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,
undefinedthe other. - ❔
undefinedboth ways. - ❌ Not exported at all.
- – Not measured.
| Export | Node.js | Browser |
|---|---|---|
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()islocalhost,uptime()is the realm's own clock,homedir()readsHOME/USERPROFILE,tmpdir()readsTMPDIR/TMP/TEMP,platform/arch/EOLare baked at build time, andnetworkInterfaces()reports loopback wherever the in-realm socket stack is installed and refuses where it is not.availableParallelism()isnavigator.hardwareConcurrency, or1where there is nonavigator, andcpus()reports that many cores with libuv's ownunknown/0fields.totalmem()/freemem()are the exception and say so:navigator.deviceMemorywhere a runtime has it, otherwise a 1 GiB placeholder announced once throughprocess.emitWarning.loadavg(),userInfo()and the priority calls still throwERR_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.