NPM.fetchInfo()

Look up information about the latest version of the specified NPM package.

This fetches the package.json string for the specified package directly from the NPM registry.

Usage

Hover over inputs/exits for more info.

var NPM = require('machinepack-npm');


// Look up information about the latest version of the specified NPM package.

NPM.fetchInfo({

packageName: 'browserify',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No package exists on the public NPM registry with the specified name.

packageNotFound: function () {

 

},

// The package.json string for the specified package could not be parsed as JSON.

couldNotParse: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

packageName required

The unique name of the NPM package.

'browserify'

Exits

error

An unexpected error occurred.

packageNotFound

No package exists on the public NPM registry with the specified name.

couldNotParse

The package.json string for the specified package could not be parsed as JSON.

success

OK.

{}