I have the following code which finds a file location for a given file. I want the value to be returned instead of console.log. Library used for finding file location - https://github.com/substack/node-findit
function searchfileloc(fname){
 var finder = require('findit')(__dirname)
 var path = require('path')
 finder.on('file', function (file) {
   if (path.basename(file) == fname){
       console.log(file); //return file
       finder.stop();
   }
  });
}
 
    