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

autorun

v1.0.3

Published

Multiplatform add/remove of executables to run on startup

Downloads

25

Readme

Autorun

Multiplatform add/remove of executables to run on startup

Run an executable on system start using AppleScript on Mac or the registry on Windows. Used in this node-webkit App: Pullover. Supports callbacks or promises (Promises/A+ compatible).

Supported Platforms:

  • Windows
  • Mac

How to use

var Autorun = require('autorun');
var autorun = new Autorun('AppName', '/Applications/pullover.app');

// Check if platform is supported
if (autorun.isPlatformSupported()) {
  // Check if autorun is enabled using callback
  autorun.isSet(function(err, enabled) {
    if (err) console.log(err);
    console.log('Autorun is ' + ((enabled) ? 'enabled' : 'disabled'));

    // Toogle autorun using promises
    if (enabled) {
      autorun.disable()
      .then(function() {
        console.log('Autorun disabled');
      })
      .catch(function(err) {
        console.log('Error disabling autorun', err);
      });
    }
    else {
      autorun.enable()
      .then(function() {
        console.log('Autorun enabled');
      })
      .catch(function(err) {
        console.log('Error enabling autorun', err);
      });
    }
  });
}

If you supply a callback it will be called once the operation is done. If you don't supply a callback, a promise will be returned.

Function reference

Autorun(appName, executablePath)

Constructor. If no appName was given, AutorunApp will be used. If no executable path was given, it will search for the current executable. Take a look at _getPathToExecutable() for more details.

isPlatformSupported() : bool

Check if platform is supported by this module.

isSet([callback]) : [promise]

Check if autorun is enabled. Returns an error if platform is not supported.

enable([callback]) : [promise]

Enable autorun. Returns an error if platform is not supported.

disable([callback]) : [promise]

Disable autorun. Returns an error if platform is not supported.

Errors

Will be returned as err parameter for callbacks or using reject for promises. An error object looks like this:

{
  name: 'AutorunEnableFailed',
  description: 'Could not enable autorun using the registry',
  platform: 'win', // os.platform()
  cause: {  // optional, if this error was triggered by another error
    name: 'ChildProcessFailed',
    description: 'Child process failed',
    output: '...', // Optional: output of the failed process
    cause: { ... }
  }
}

Possible error names are: PlatformUnsupported, AutorunEnableFailed, AutorunDisableFailed, AutorunIsSetFailed, ChildProcessFailed

How it works

Under Mac AppleScript is used to create a new login item. The only way to differentiate between login items is by their executable path. So make sure to always supply the correct executable path. An error is thrown under Mac if the executable does not exist. Under Windows the registry is used to add/remove an item to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. Windows identifies the item by it's AppName, so make sure to always use the same.

License

The MIT License (MIT)

Copyright (c) 2014 Christoph Groß <[email protected]> (http://chris-labs.de)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.