Registry / devops / bare-os

bare-os

JSON →
library3.8.7jsnpmunverified

bare-os provides essential operating system utilities tailored for the `bare` JavaScript runtime, a lightweight and modular environment designed for peer-to-peer applications across desktop and mobile devices. Unlike Node.js, the `bare` runtime emphasizes a minimal core, relying on modular userland libraries like `bare-os` for functionalities typically found in a standard library. Currently at version 3.8.7, the package exhibits active development, with recent updates and a healthy maintenance status. It is a key component within the Holepunch ecosystem, focusing on efficiency and cross-platform compatibility, particularly for networked applications requiring direct user-to-user connections without traditional servers. The library ships with TypeScript types, ensuring robust development experiences.

npm install bare-os
INSTALL
IMPORT
SIG · BARE-OS
B
bare-os
devopsjavascriptv3.8.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

platform
import { platform } from 'bare-os';
const os = require('bare-os'); os.platform();
ESM is the preferred import style. Type declarations are included.
homedir
import { homedir, tmpdir } from 'bare-os';
import os from 'bare-os'; os.homedir();
bare-os exports named functions, not a default object. Destructure directly.
totalmem
const { totalmem } = require('bare-os');
const totalmem = require('bare-os').totalmem;
CommonJS `require` works, but named destructuring is cleaner than accessing properties directly.

Demonstrates importing and using several core OS utility functions like `platform`, `homedir`, and `totalmem`.

import { platform, arch, homedir, totalmem, freemem, uptime } from 'bare-os'; async function getSystemInfo() { console.log(` --- System Information --- `); console.log(`Platform: ${platform()}`); console.log(`Architecture: ${arch()}`); console.log(`Home Directory: ${homedir()}`); const totalMemoryBytes = totalmem(); const freeMemoryBytes = freemem(); console.log(`Total Memory: ${(totalMemoryBytes / (1024 ** 3)).toFixed(2)} GB`); console.log(`Free Memory: ${(freeMemoryBytes / (1024 ** 3)).toFixed(2)} GB`); const systemUptimeSeconds = uptime(); const hours = Math.floor(systemUptimeSeconds / 3600); const minutes = Math.floor((systemUptimeSeconds % 3600) / 60); console.log(`System Uptime: ${hours}h ${minutes}m`); console.log(` -------------------------- `); } getSystemInfo().catch(console.error);
Debug
Known issues
breaking`bare-os` is specifically designed for the `bare` JavaScript runtime and is not directly compatible with Node.js or browser environments.
fix
Ensure your application is running in a `bare` environment. For Node.js compatibility with `os` module functions, consider using `bare-node-os` (installed as `os@npm:bare-node-os`).
affects: >=1.0.0
gotchaThe `bare` runtime's compile options, which can influence underlying behaviors, are not covered by semantic versioning and may change without warning, potentially affecting `bare-os` behavior.
fix
Refer to the `bare` runtime documentation for specific compile options and ensure your `bare` runtime version is tested and stable for your application's use case.
affects: *
gotchaThe `bare-os` module exports named functions directly. Attempting to import it as a default export or access properties on a `require`'d object without destructuring can lead to undefined errors.
fix
Use named imports for ESM (`import { funcName } from 'bare-os'`) and destructuring for CJS (`const { funcName } = require('bare-os'`) to correctly access the desired utilities.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'platform')
Attempting to access a property on an undefined `os` object, likely due to incorrect ESM default import or CJS non-destructured `require`.
fix
Correct your import/require statement: `import { platform } from 'bare-os';` or `const { platform } = require('bare-os');`
Error: Module not found: Can't resolve 'bare-os'
The package `bare-os` is either not installed or the runtime environment does not recognize it.
fix
Install the package via `npm i bare-os` and ensure you are running your application in the `bare` runtime environment.
Upgrade
Version history
3.8.7latest on npm
Audit
Dependencies
barerequiredRequired runtime environment, not compatible with Node.js directly.
Agent activity
4 hits · last 30 days
node
4
Resources
bare-os — npm install bare-os · libregistry