If user pass errors and data then we use Error-first callbacks .There are two argument in callbacks. first argument is always an error object which is for to check if something went wrong. and we use additional argument along with this parameter for passing data.
Ex :-
fs.readFile(filePath, function(err, data) {
if (err) {
//handle the error
}
// use the data object
});
0 Comment(s)