1.

Does fs module methods support both synchronous and asynchronous forms and which method forms are preferred and why?

Answer»

Yes.Every method of fs module SUPPORTS both synchronous and asynchronous forms.

Asynchronous methods TAKE the first parameter of CALLBACK function as error and last parameter as completion function.

It is better to use an asynchronous method as it NEVER blocks as program during execution WHEREAS synchronous methods does block the program during execution.



Discussion

No Comment Found