@bobfrankston/platformapi
v0.1.2
Published
Native platform API access for Node.js and Bun
Maintainers
Readme
platformapi
Native platform API access for Node.js and Bun. FFI-based (koffi/bun:ffi) - no native compilation.
Installation
npm install @bobfrankston/platformapiQuick Start
import { listDisplays, getBrightness, setBrightness } from '@bobfrankston/platformapi';
// List all displays
const displays = await listDisplays();
// [{ index: 0, name: "Dell U2720Q", brightness: 50, bounds: {...} }, ...]
// Get/set brightness by display index
const level = await getBrightness(0); // 50
await setBrightness(0, 75);
// Set all displays
for (const d of displays) await setBrightness(d.index, 60);API
Display Enumeration
interface DisplayInfo {
index: number; // 0-based
name: string; // Display name/model
brightness: number | null; // Current brightness 0-100, null if unsupported
bounds: { left, top, width, height };
primary: boolean;
}
const displays = await listDisplays();Brightness Control
const level = await getBrightness(displayIndex); // 0-100
await setBrightness(displayIndex, brightness); // 0-100Platform Support
| Platform | Status | |----------|--------| | Windows | ✓ | | Linux | ✓ | | macOS | Planned |
Linux Setup
sudo apt install ddcutil
sudo usermod -aG i2c,video $USERRelated
- @bobfrankston/winpos - Window positioning and screen layout
License
MIT
