What is difference between synchronous and asynchronous method of fs module?

Technology CommunityCategory: Node.jsWhat is difference between synchronous and asynchronous method of fs module?
VietMX Staff asked 3 years ago

Every method in fs module has synchronous as well as asynchronous form. Asynchronous methods takes a last parameter as completion function callback and first parameter of the callback function is error. It is preferred to use asynchronous method instead of synchronous method as former never block the program execution where the latter one does.