NodeJS - convert relative path to absolute

Use path.resolve

try:

resolve = require('path').resolve
resolve('../../bb/tmp.txt')

You could also use __dirname and __filename for absolute path.