Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

win32-fun

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

win32-fun

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

latest
Source
npmnpm
Version
1.1.5
Version published
Maintainers
0
Created
Source

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)

FAQs

Package last updated on 27 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts