NPM unable to read file

I have written a NPM module. which needs to read a file. While creating NPM module I have placed a file in same directory with .js file and used

var file = './sqlmap_config.json';

This files gets included well when I use the code standalone. When I create NPM module, this file is looked up in parent directory where NPM module is installed and code fails.

Do I need to hard code it to

var file = './node_modules/module/sqlmap_config.json';

Or there is any other way to accomplish this

I think you are going to want to use something like :

var file = __dirName + '/sqlmap_config.json';

http://nodejs.org/api/all.html#all_dirname