1.1.4 • Published 3 months ago

win32-fun v1.1.4

Weekly downloads
5
License
ISC
Repository
github
Last release
3 months ago

Win32 Fun

Usage

disk memory information, put the monitor into sleep mode, wake up the monitor, set volume

  const win32Fun = require('win32-fun');
  // retrieving disk memory information
  const { free, total, available } = await win32Fun.getDiskSpace('c:');
  const { free, total, available } = win32Fun.getDiskSpaceSync('c:');
  // put the monitor into sleep mode
  win32Fun.turnOffMonitor();
  // wake up the monitor
  win32Fun.turnOnMonitor();
  // prevent system lock screen
  win32Fun.preventLockScreen();
  // set volume
  win32Fun.setVolume(30); // 0 - 100

Screen sleep example

let running = true

async function screenWakeUpAfter(timeout) {
  setTimeout(() => {
    running = false
  }, timeout)
}

async function screenSleep() {
  while (running) {
    console.log('turn off monitor')
    win32Fun.turnOffMonitor()
    win32Fun.preventLockScreen()
    await (new Promise(resolve => setTimeout(() => resolve(), 5000)))
  }
  console.log('turn on monitor')
  win32Fun.turnOnMonitor()
}

screenSleep()
screenWakeUpAfter(30000)
1.1.1

3 months ago

1.1.4

3 months ago

1.1.2

3 months ago

1.1.0

2 years ago

1.0.1

4 years ago

1.0.0

4 years ago