resolve-bin
Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.
Last updated 11 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install resolve-bin 
SYNC missed versions from official npm registry.

resolve-bin Tests

Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.

var resolveBin = require('resolve-bin');

// package.json: "bin": "bin/tap.js"
resolveBin('tap', function (err, bin) {
  if (err) return console.error(err);
  console.log(bin);  
});

// => [..]/resolve-bin/node_modules/tap/bin/tap.js

Installation

npm install resolve-bin

API

resolveBin(name, opts, cb)

Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.

Parameters:
Name Type Argument Description
name string

module name, i.e. 'tap'

opts Object <optional>

options

Properties
Name Type Description
executable string

(default: @name) executable name (e.g. 'buster-test')

cb function

called back with the full path to the bin file of the module or an error if it couldn't be resolved

Source:

resolveBin::sync(name, opts) → {string}

Synchronous version of resolveBin

Parameters:
Name Type Argument Description
name string

module name, i.e. 'tap'

opts Object <optional>

options

Properties
Name Type Description
executable string

(default: @name) executable name (e.g. 'buster-test')

Source:

generated with docme

License

MIT

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

10 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.4.3                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           9 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |