Return value from EventEmitter


#1

I’m new to using npm modules and I am having a problem getting the returned value from an EventEmitter.
I want to parse an email object but I am getting an undefined value as a return.

Meteor.methods({
‘parseEmail’: function (data) {
var mailParser = Meteor.npmRequire(‘mailparser’).MailParser;
var mp = new mailParser()

   mp.on("end",Meteor.bindEnvironment(function (data) {
        return data
    }))

    mp.write(data);
    mp.end();
}

})