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

Why readFileSync instead of async readFile? #92

Open
fullofcaffeine opened this issue Nov 29, 2019 · 1 comment
Open

Why readFileSync instead of async readFile? #92

fullofcaffeine opened this issue Nov 29, 2019 · 1 comment

Comments

@fullofcaffeine
Copy link

fullofcaffeine commented Nov 29, 2019

Hi!

I'm wondering why you used readFileSync and statSync in the i18n middleware, here:

values: fs.readFileSync(`${localesDir}/${locale}/${ns}.json`, { encoding: 'utf-8' }),

It could probably be changed to use the async versions, or is there a specific reason(s) you chose the sync/blocking versions?

@manuelbieh
Copy link
Owner

The whole i18n live update thing is still very early stage. I don't remember why I chose the synchronous versions over the async ones, there might have been a reason, but I honestly don't remember it. I will keep it in mind and consider rewriting it using the async versions. Thanks!

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

2 participants