console.log('Starting app ...');

const fs = require('fs');
const os = require('os');

var user = os.userInfo();

console.log('Writing to file greetings.txt...');
//Synchronous call
fs.appendFileSync('greetings.txt', 'hello ' + user.username + ' ...\n');

// Asynchronous call
fs.appendFile('greetings.txt', `hello ${user.username} ...\n`, function (err) {
	if (err) {
		console.error('File write failed.');
	}
});

console.log('Completed app ...');