![]() What I would do, is import the function instead and then pass it a different buffer in different js files where different pdf is required. So you have to use it within the same file. I don't think you can store the chunks as a global variable though as you would have to export the chunk (e.g module.exports = getPDF(buffer) ), which is synchronous, while the function getPDF is asynchronous. I have tried storing the elements of the array inside variables while inside the function, but no luck. I want to store it in some global variable so that I can use it in different files. you can get the chunks given the buffer here! Packed with great features: Search & Navigate, Focus mode, Typewriter scrolling, Word counting. ![]() Screen mode - Shortcut keys - Paragraph Numbers - X-Callback-URL support - Emoji. Outlinely provides the best environment for ideas and insights. Outlinely is the home for all your notes, thoughts, ideas and todos. ![]() ![]() So you can refactor your code so that it looks like the following: var pdfText = require('pdf-text') Outlinely is the home for all your notes, thoughts, ideas and todos. I keep those notes in Outlinely, copy the Outlinely x-callback-url and paste that into the OF task so I can click it and open the outline of what I want to. If you are using node 8, I believe you can use the async-await feature. callback function is called with (1, 2) and it returns None (Without return statement, your function prints Sum 3 and returns None) main function is called with None as argument (So callback None will always be False) Share Improve this answer Follow answered at 11:28 ettanany 18. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |