fs.unlink(path,
callback)
Remove
a file or symbolic link asynchronously. Callback function takes an ‘err’
argument and it is called on unlink method execution.
var fs = require('fs'); var fileToRemove = 'input.txt'; fs.unlink(fileToRemove, (error) => { if (error) { console.log(`Unable to delete the file ${fileToRemove}, ${error}`); } else { console.log(`File ${fileToRemove} is removed successfully`); } });
No comments:
Post a Comment