I m using nodejs, I got the following error while appending a file. const fs = require('fs');
fs.appendFile('message.txt', 'Hello, user how are you?');
Solution:
The fs.appendFile function expecting third parameter as call back function.
const fs = require('fs');
fs.appendFile('message.txt', 'Hello, user how are you?', (err) => {
if (err) throw err;
console.log('The "data to append" was appended to file!');
});