Edge.js passing buffer to callback

234 Views Asked by At

I'm using Edge.js to execute node.js modules within my F# code. My node module returns Stream and I've found, that I should marshall it with node buffer.

My function called from .NET looks like this:

return function(data, cb){
    var pdfDoc = printer.createPdfKitDocument(dd);

    var bufs = [];
    pdfDoc.on('data', function(d){ bufs.push(d); });
    pdfDoc.on('end', function(){
        var buf = Buffer.concat(bufs);
        cb(null, buf);
    });

    pdfDoc.end();
}

It works perfectly when I call this function from node.js, but with Edge.js it hangs and Task is never awaited. Is Edge.js doing anything special to streams ? Am I missing something ?

0

There are 0 best solutions below