Socket
Socket
Sign inDemoInstall

stay-awake

Package Overview
Dependencies
3
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stay-awake

Prevents computer from going into automatic sleep


Version published
Weekly downloads
3
decreased by-76.92%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

node-stay-awake

Node module which prevents computer from going into automatic sleep. Currently supports windows and mac osx.

Installation

npm install stay-awake

Usage

var stayAwake = require('stay-awake');

// do something not so important

// prevent auto sleep
stayAwake.prevent(function(err, data) {
    // handle error
    console.log('%d routines are preventing sleep', data);
});

// do something which needs the computer to stay awake

// do something async
doAsync(function() {
    // do something
    stayAwake.prevent(function() {}); // second call
    // do long processing
    stayAwake.allow(function() {}); // this subroutine no longer needs to prevent sleep
});

// once done allow the computer to sleep as configured in power management
stayAwake.allow(function(err, data) {
    if(data == 0) {
        console.log('Will sleep automatically');
    }
}); // allow

Keywords

FAQs

Last updated on 29 Oct 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc