const fs = require('fs');
const path = require('path');
const filename = '/test.js';
const text_to_append_to_file = '\nLast line of text';
fs.appendFile(path.join(__dirname, filename), text_to_append_to_file, err => {
if (err) throw err;
console.log(`Append to file ${filename} success`);
});
/*
run:
Append to file /test.js success
*/