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!');
});
Post your comments / questions
Recent Article
- How to programmatically modifying the AppSetting value in web.config using c#?
- How to calculate the age from jQuery ui datepicker using c#?
- How to calculate days difference between two dates in c#?
- Changing date format in jQuery ui datepicker
- How to set value to nicedit textarea using jQuery?
- How to load data from json file in angular?
- cannot find module consider using '--resolvejsonmodule' to import module with json extension angular
- How to create multi select dropdown in Angular?
Related Article