I am a beginner to the nodejs. When I type the below, the code error occurs like this:
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
var fs = require('fs');
fs.readFile('readMe.txt', 'utf8', function (err, data) {
fs.writeFile('writeMe.txt', data);
});
Kenil Vasani
Fs.writeFile() according to the documentation here takes (
file, data[, options]and callback ) params so your code will be like this :