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

Use async fs functions #124

Closed
wants to merge 4 commits into from
Closed

Use async fs functions #124

wants to merge 4 commits into from

Conversation

ianshade
Copy link

This is my attempt at getting rid of synchronous fs calls, which is supposed to fix #107.
I too noticed that the event loop was blocked in some scenarios, for example when a high number of files was being created in watched folder in a short period of time. After these changes it performs much better and doesn't block.

I decided to use fs-extra for the promise-based functions but that might have been unnecessary because that library supports only node >= 12, so node-watch doesn't really gain anything by using it.

But are you okay with dropping support for some older versions of node at all?

I could do the following things if node >= 12 was too high:

  • wrap the callback-based functions myself but keep async/await: node >= 8
  • use fs.promises: node >= 10

I think that would also mean recursive: true would always be natively supported.

@yuanchuan
Copy link
Owner

Hi @ianshade, thank you so much for the effort!

I would like to use latest JS features but the current plan is to keep this project change as less as possible. I'm not sure if the change will bring other issues, which is acceptable. I just don't have much time to continue to test and fix them.

I'll hold this pr for some time!

@yuanchuan
Copy link
Owner

I need to close this PR. Thanks again!

@yuanchuan yuanchuan closed this Oct 30, 2022
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

Successfully merging this pull request may close these issues.

Avoid synchronous fs calls
2 participants