I have simple question about fs and async in nodejs.
var fs=require('fs');
fs.appendFile('mynewfile1.txt', 'Hello content!', function (err) {
if (err) throw err;
console.log('Saved!');
});
fs.unlink('mynewfile1.txt', function (err) {
if (err) throw err;
console.log('File deleted!');
});
Output I get is this
File deleted!
Saved!
But file is being already deleted and newfile is not created in my dir. Should in’t throw error or create new file. Why neither of this happening?