haz

Determines if a program exists in the PATH environment variable. Cross platform, including support for checking likely executable file extensions on Windows. Available in synchronous and asynchronous versions.

npm install haz
2 downloads in the last week
4 downloads in the last month

haz

Determines if a program exists in the PATH environment variable. Cross platform, including support for checking likely executable file extensions on Windows. Available in synchronous and asynchronous versions. Thorough unit tests included.

Installation

npm install haz

Usage

Here's a synchronous example:

var haz = require('haz');

if (haz('convert')) {
  // Great, use spawn to run imagemagick's convert
}

And here's an asynchronous example with a callback:

var haz = require('haz');

haz('convert', function(result) {
  if (result) {
    // Great, use spawn to run imagemagick's convert
  }
});

If you don't pass a callback, it behaves synchronously. Simple, right?

Tests

npm test

The tests convince haz that is running in a realistic Windows environment for the Windows tests, and do the same for the Linux/Unix/MacOS/whatever tests.

About P'unk Avenue and Apostrophe

haz was created at P'unk Avenue for use in many projects built with Apostrophe, an open-source content management system built on node.js. (You don't need Apostrophe to use haz.) If you like haz you should definitely check out apostrophenow.org. Also be sure to visit us on github.

Support

Feel free to open issues on github.

npm loves you