reactphp / filesystem

Evented filesystem access.
MIT License
135 stars 40 forks source link

Add a synchronous adapter #87

Closed SamMousa closed 3 years ago

SamMousa commented 3 years ago

While I recognize that the primary purpose of reactphp/filesystem is to have non-blocking io, it does have some other benefits:

In some cases the potential gains from non-blocking io are not worth guaranteed costs. In such scenarios it would still be nice to have a synchronous adapter that allows us to use the same code.

From a consumer point of view as long as the functions return promises it doesn't matter if it is blocking or not.

WyriHaximus commented 3 years ago

From a consumer point of view as long as the functions return promises it doesn't matter if it is blocking or not.

From anything else inside the event loop is does matter, as they will be blocked by any blocking operation. And that is something we don't support in any of our packages.

SamMousa commented 3 years ago

And that is something we don't support in any of our packages.

Fair enough, if that's the choice that has been made no there's no use discussing the worth of synchronous implementation(s).