According to the Node.js manual:
If you want the root of your module\'s export to be a function (such as a constructor) or if you want to export a c
The example code is:
in main
square(width,function (data) { console.log(data.squareVal); });
using the following may works
exports.square = function(width,callback) { var aa = new Object(); callback(aa.squareVal = width * width); }