Blocking I/O code is easier to write unless you start doing it with multiple threads in which case it may no longer be easier. When I write a one-time use script (not a server) such as a script to process a bunch of files on my hard drive, I will sometimes use the synchronous versions of file I/O such as fs.readFileSync()
because it's just simpler and easier to write. FYI, I never use synchronous I/O in a server (other than at server initialization time) because it wrecks the scalability of the server when used in real time requests.
As an example of how synchronous I/O is simpler, require()
uses synchronous file I/O. If it didn't, then initializing a module that had multiple external modules to load (some of which depend on each other) could get a lot more complicated than just lining up four require()
statements on successive lines.
Non-blocking I/O code requires learning new techniques in order to serialize multiple I/O requests (learning callbacks or promises), but allows you to write code that scales really well without having to worry about thread synchronization and without risking the bugs that often occur in multi-threaded code.