I\'m looking for a way to find out if a module is available.
For example, I want to check if the module mongodb is available, programmatically.
Maybe resolve-like modules will be helpfully here?
The numbers of modules are exist on npm:
I wrote first, async-resolve, and for example:
var Resolver = require('async-resolve');
var resolver_obj = new Resolver();
resolver_obj.resolve('module', __dirname, function(err, filename) {
return console.log(filename);
});
It use node modules path resolutions rules but don't block main loop as node do it. And in result you get filename, so it can be used to decide its local module or global and other things.