absolute path nodejs code example
Example 1: node.js name of file
var path = require('path');
var scriptName = path.basename(__filename);
Example 2: node get absolute path
// to get a valid absolute path
resolve = require('path').resolve
resolve('../../bb/tmp.txt')
// to get current file directory
__dirname