galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

promise / callback #252

Open thbl opened 6 years ago

thbl commented 6 years ago

How can i make a callback, when pdfWriter.end(); is done ?

chunyenHuang commented 6 years ago

It's sync execution, so you can add the callback in your wrapped function. You can wrap the hummusJS like:

function pdfWriterWrapFunction(cb){
    const pdfWriter = ...
    ...
    pdfWriter.end()
    if(cb) return cb();
}
thbl commented 6 years ago

okay thanks ! :)