node package manager
Painless code sharing. npm Orgs help your team discover, share, and reuse code. Create a free org »

packageroot

Build Status

packageroot

return the closest parent or current directory that contains a package.json

example

var packageroot = require('packageroot');
 
packageroot('./',function(err,root){
  console.log(root);
  // if im in /root/package/test it would print 
  // /root/package 
});