title: How to get details of npm installed modules programatically?
body: <p>Is there way or library that could tell where from require'd module was resolved and especially what binaries it possibly contains?</p>
  
  <p>For example, when I require('coffee-script') there is (AFAIK) no way to tell its installation directory and what command line binaries it has.</p>
  
  <p>What I ideally need is some kind of mix between require and package.json parser, e.g. like following hypotethical 'npminfo' library.</p>
  
  <pre><code>var npminfo = require('npminfo')
  
  // get info about module
  var pkginfo = npminfo.resolve('coffee-script')
  pkginfo.version =&gt; '1.1.0'
  pkginfo.path  =&gt; '/home/teemu/node_modules/coffee-script'
  pkginfo.bins =&gt;  { coffee: '/home/teemu/node_modules/coffee-script/bin/coffee', cake: '/home/teemu/node_modules/coffee-script/bin/cake'}
  
  // generic info
  npminfo.binpath =&gt; '/home/teemu/.node_modules/bin' 
  </code></pre>
  
  <p>I did try to use require.paths and just walk through directories, but for some reason it does not contain path where my modules are actually installed. Somehow require still finds them though?</p>
  
  <pre><code>~ $ node
  &gt; require.paths
  [ '/Users/teemuikonen/.node_modules',
    '/Users/teemuikonen/.node_libraries',
    '/usr/local/lib/node' ]
  &gt;
  
  ~ $ ls /usr/local/lib/node
  wafadmin
  
  ~ $ ls .node_modules/
  ls: .node_modules: No such file or directory
  
  ~ $ ls node_modules/
  cli  cradle coffee-script ...   
  </code></pre>
  
  <p>Thanks</p>