phantom-html-to-pdf
phantom-html-to-pdf copied to clipboard
remove pdf temp file
this PR implements what i say in this issue.
for now, i've only removed the temporal pdf file (since it is the file that causes more troubles and the most important part of this module), we can discuss if we should remove the others files (templates) here, or after rendering, or implement other technique for template sharing, personally i would vote for the remove other files after rendering.
IMPORTANT NOTE: the temp pdf file is only removed if the user has been consumed the file, if the file it is not consumed, the pdf file will stay on disk, let me know if you would like me to implement the remove of the file even if it is not consumed (after conversion
's callback execution), i have not do this because maybe there are edge cases when the pdf stream
is used after the conversion
's callback execution, but we can add to docs that we always clean up the pdf file, so the user will know that it has to consume the file in conversion
's callback, not later because it will be removed.
i've ended up implementing the remove of the file even when is not consumed, let me know what you think.
Thank you for this very nice implementation. I'm not very good in node.js streams so it is hard for me to give some valuable comments. I've summarized approaches for dealing with temp files here, so we can choose what will be implemented or merged
https://github.com/pofider/phantom-html-to-pdf/issues/44#issuecomment-272849974
What's the state of this?