Node.js fs unlink() delete a file asynchronously

Description

Node.js fs unlink() delete a file asynchronously


var fs = require('fs');
console.log('Going to delete an existing File');
fs.unlink('newfile.txt', function(err) {
  if (err) {/* ww w  .j a  v  a  2  s. c  o m*/
    return console.error(err);
  }
  console.log('File deleted successfully !');
});



PreviousNext

Related