Find Binary

Path: /src/method/npmbin.coffee compiled to /lib/method/npmbin.js

This will search a binary in the NPM modules directories.

Find the defined binary in node_modules directories. It will search in the current and upper package directories.

Example:

CoffeeScript Code
fs = require 'alinex-fs' fs.npmbin 'coffee', (err, cmd) -> console.log "Coffee command found at:" + cmd

npmbin()

Usage:npmbin(bin, dir, cb)

Parameter
  • bin - String name of the binary to search for
  • dir - String directory to start search from
  • cb - function(<Error>, <String>) callback with an Error or the found binary’s path

npmbinSync()

Usage:npmbinSync(bin, dir)

Parameter
  • bin - String name of the binary to search for
  • dir - String directory to start search from
Return
String the found binary’s path
Throws
  • Error if binary could not be found