node package manager


An asynchronous and configurable implementation of require.resolve(), like node-resolve or enhanced-resolve.


This module a fastest async and configurable requre.resolve() implementation.

$ npm install async-resolve

Resolve absolute path for given [file|directory|module] in given basedir in asynchronous manner.

var Resolver = require('async-resolve');
var resolver_obj = new Resolver();
resolver_obj.resolve('module', __dirname, function(err, filename) {
  return console.log(filename);
var Resolver = require('async-resolve');

The resolver object may be configured on creation time:

options = {
  // default: ['.js', '.json', '.node'] - specify allowed filetypes, note that the 
  // order matters. in this example index.js is prioritized over 
  extensions: ['.js', '.coffee', '.eco'],
  // default : false - make searching verbose for debug and tests 
  log: true
  // default : 'node_modules' - its 'node_modules' directory names, may be changed 
  modules : 'other_modules'
resolver_obj = new Resolver(options);

Resolve pkg in basedir on node.js-based algorithm

resolver_obj.resolve('module', __dirname, function(err, filename) {
  return console.log(filename);

also resolver object may be configured after creation:


All options may be inspected (for testing and debug):

  log: true,
  modules : 'other_modules',
  extensions: [ '.js', '.coffee', '.eco', '.jade' ],
  dir_load_steps: [

Return true if filename is node.js core module or false otherwise.

resolver_obj.isCoreModule('util'); // -> true 

This method use internal module names table for fast lookup, not IO.

$ cake test

In short async-resolve 2.4 times as fast as enhanced-resolve.

My benchmark results.

Build you own in 2 steps:

  1. do $ npm install at root module folder
  2. run $ coffee ./bench/ from root module folder

Copyright (c) 2013 Dmitrii Karpich