Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File reading/writing optimization to async #34

Open
Zirafnik opened this issue Apr 20, 2023 · 0 comments
Open

File reading/writing optimization to async #34

Zirafnik opened this issue Apr 20, 2023 · 0 comments

Comments

@Zirafnik
Copy link

I have noticed, while quickly going through the codebase, that this library uses existsSync, mkdirSync, readFileSync and writeFileSync inside otherwise already async functions. Is there a reason for that?

This blocks the execution, instead of allowing Node to process along further, while the OS (filesystem) is writing/reading files.

Should we not update the code to at least use async versions from fs/promises? Optimally, I believe streams should be used, like createReadStream and createWriteStream, to minimize the impact on memory.

After a week of testing pretty much all the pdf-to-img libraries out there, this is the only one that works properly, and gives me good quality images. The only problem I now have is that it is slow.

PDF2Pic, has a nice code utilizing streams, which is extremely fast and efficient, but the owner no longer updates the library, and there are quite a few broken things, such as density, which controls the output quality. I am mentioning it here only as a potential source of inspiration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant