npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

schedule-shutdown

v1.3.0

Published

Schedules shutdowns for your computer

Readme

schedule-shutdown

Build Status Coverage Status NPM version Prettier License

schedule-shutdown is a CLI tool to schedule computer shutdowns. This can be useful when:

  • You want to start a large download before you leave the computer, but you know the download will be finished well before you get back
  • You already know the command shutdown.exe /s /t <seconds>, but you can't be bothered converting 2 hours and 47 minutes into seconds
  • You want something to force you to go to bed at a reasonable hour

Requires Node 8 or above. Currently supports Windows, Linux, and macOS. schedule-shutdown can also be used as a library.

Usage

CLI

Install schedule-shutdown with either of the following, depending on your preferred package manager:

  • yarn global add schedule-shutdown
  • npm install --global schedule-shutdown

Then use it like so:

$ schedule-shutdown --help
schedule-shutdown <duration>

Schedules a shutdown after the provided duration has elapsed

Commands:
  schedule-shutdown <duration>     Schedules a shutdown after the provided
                                   duration has elapsed                [default]
  schedule-shutdown cancel         Cancels a previously scheduled shutdown or
                                   restart

Options:
  --verbose      Log the internal commands used and their outputs
                                                      [boolean] [default: false]
  -r, --restart  Schedule a restart instead of a shutdown
                                                      [boolean] [default: false]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

Examples:
  schedule-shutdown 5m     Shutdown in 5 minutes
  schedule-shutdown 30m    Shutdown in 30 minutes
  schedule-shutdown 1h30m  Shutdown in 1 hour and 30 minutes
  schedule-shutdown 3h     Shutdown in 3 hours
  schedule-shutdown 0m     Shutdown immediately
  schedule-shutdown -r 2h  Restart in 2 hours

$ schedule-shutdown 1h20m
Shutdown scheduled for Tue Dec 04 2018 7:26:20 PM

$ schedule-shutdown cancel
Scheduled shutdown or restart cancelled

$ schedule-shutdown --restart 3h
Restart scheduled for Tue Dec 04 2018 9:06:30 PM

$ schedule-shutdown cancel
Scheduled shutdown or restart cancelled

To uninstall, do one of the following, depending on how you installed it:

  • yarn global remove schedule-shutdown
  • npm uninstall --global schedule-shutdown

API

If you have your own project where you want to shutdown people's computers, you can use schedule-shutdown as a library:

import { cancelShutdown, scheduleRestart, scheduleShutdown } from 'schedule-shutdown';

async function main() {
    // shutdown in 1 hour and 20 minutes
    const shutdownTime = await scheduleShutdown('1h20m');
    console.log(`Shutting down at ${shutdownTime.toLocaleTimeString()}`);
    await cancelShutdown();
    console.log('Shutdown cancelled');

    // restart in 5 minutes
    const restartTime = await scheduleRestart(5);
    console.log(`Restarting at ${restartTime.toLocaleTimeString()}`);
    await cancelShutdown();
    console.log('Restart cancelled');
}

main().catch(console.error);

scheduleShutdown(duration, [verbose=false])

Schedules a shutdown after the provided duration has elapsed. The duration can be a number of minutes, or a non-empty string matching the regular expression (\d+h)?(\d+m)?.

Returns a promise which resolves when the shutdown is successfully scheduled. The resolved value is the scheduled shutdown time as a Date object. The promise will reject if the internal command failed.

If verbose is set to true, then the internal commands and their outputs will be logged to the console.

scheduleRestart(duration, [verbose=false])

Exactly like scheduleShutdown(duration, [verbose=false]), but schedules a restart instead.

cancelShutdown([verbose=false])

Cancels a previously scheduled shutdown or restart.

Returns a promise which resolves when the shutdown cancelled successfully. The promise will reject if the internal command failed.

If verbose is set to true, then the internal commands and their outputs will be logged to the console.