1.0.0 • Published 7 years ago

vaka v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

vaka

Prevent a system running macOS from going to sleep. Picks the preferred method (pmset/caffeinate) depending on system version.

usage

const vaka = require(`vaka`)

// Prevent sleep indefinitely
vaka()
.then(console.log.bind(null, `caffeinate/pmset pid:`))
.catch(console.log)

// Prevent sleep until process exits
vaka({ pid: process.pid })
.then(console.log.bind(null, `caffeinate/pmset pid:`))
.catch(console.log)

// Prevent sleep for 10 seconds
vaka({ timeout: 10 })
.then(console.log.bind(null, `caffeinate/pmset pid:`))
.catch(console.log)

api

vaka([options])

Returns a Promise which resolves to the pid belonging to the underlying pmset or caffeinate instance.