Advertisement
Gottox

Untitled

Oct 20th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var pdfutils = require('./index').pdfutils;
  2.  
  3. // pdfutils is a factory which starts a background thread
  4. // this thread is terminated in the destructor of the C++ class connected to doc
  5.  
  6. // This frees the doc-class
  7. pdfutils("test.pdf", function(err, doc) {
  8. console.dir(doc);
  9. });
  10.  
  11. // This doesn't, which prevents node from exiting
  12. // because doc isn't deconstructed and therefore
  13. // the background thread stays running.
  14.  
  15. pdfutils("test.pdf", function(err, doc) {
  16. setTimeout(function() {
  17. console.dir(doc);
  18. }, 1000);
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement